Jump to content
JChartFX Community
  • 0
Sign in to follow this  
robert.gregor

Two Y axis with jQuery. Cannot make it work to use axisY2

Question

Hello,

I want to use axisY2 with jQuery. I am loading the data via ajax. Here is my code:

 

 function drawChart(divId, compId, range, type) {
                $.ajax({
                    url: "/",
                    type: "get",
                    'cache' : false,
                    data: "ServiceName=GetHistoryDataJson&deviceId="+compId+"&range="+range+"&"+Math.floor((Math.random()*100)+1),
                    success: function(data) {
                        var items = JSON.parse(data);
                           divId.chart({
                                gallery:cfx.Gallery.Lines,
                                dataValues: items,
                                data: {series: 2},
                                dataSourceSettings: {
                                    fields: [{ name: "yData", displayName: chart_current, usage: cfx.FieldUsage.Value },
                                        { name: "yDataExpected", displayName: chart_expected, usage: cfx.FieldUsage.Value },
                                        { name: "xData", usage: cfx.FieldUsage.XValue}]
                                },
                                allSeries: {MarkerShape: cfx.MarkerShape.None},
                                axisX: {LabelsFormat: {Format: cfx.AxisFormat.Date, CustomFormat:"HH:mm dd/MM/yy"}},
                                axisY: {DataFormat:Number, AutoScale: true },
                                axisY2: {DataFormat:Number, AutoScale: true },
                            });
                    }
 
It is still displaying one axis x, where I have xData and one axis Y, where I have two data lines yData and yDataExpected. What I want is to have left main axisY populated with yData and then on the right axisY2, which will be populated with yDataExpected. How can I do it?

post-46705-0-48025200-1408700839_thumb.png

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×