Jump to content
JChartFX Community
  • 0

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


robert.gregor

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

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...