uberphoebe Posted April 7, 2014 Report Share Posted April 7, 2014 I am drawing a bar graph and the max value is "9". Three value 9,0,3 The y scale is showing 100..... If I switch max scale to 9 it works but autoscaling (which I want) is going wonky, Any ideas....please? Quote Link to comment Share on other sites More sharing options...
0 JuanC Posted April 7, 2014 Report Share Posted April 7, 2014 One possibility would be that you are letting the chart to initialize with random data and after that we are not resetting the min/max to the real data scale. Can you clarify when are you passing the data to the chart? Can you post a small sample page that duplicates the issue you are experiencing? JuanC Quote Link to comment Share on other sites More sharing options...
0 uberphoebe Posted April 7, 2014 Author Report Share Posted April 7, 2014 Ok lets say gn="car" gl="old,new" pos="24,3" neg="18,23 var chart3 function loadGroupChart(gn,gl,pos,neg) { var gla=gl.split(","); var posa=pos.split(","); var nega=pos.split(","); var i=gla.length; chart3 = new cfx.Chart(); chart3.setGallery(cfx.Gallery.Bar); var data = chart3.getData(); data.setSeries(2); data.setPoints(i); //load data points for(var j=0;j<i;j++) { data.setItem(0, j, posa[j]); data.setItem(1, j, nega[j]); // Series X axis labels chart3.getAxisX().getLabels().setItem(j,gla[j]); } // Series data name chart3.getSeries().getItem(0).setText("Positive"); chart3.getSeries().getItem(1).setText("Negative"); //recalculate scales chart3.recalculateScale(true); // Series X axis labels chart3.getLegendBox().setVisible(true); chart3.getAxisY().getGrids().getMajor().setVisible(true); chart3.getAxisY().getGrids().getMinor().setVisible(true); document.getElementById('ChartDiv3').innerHTML = ""; document.getElementById('ChartDiv3').innerHTML = "Analysis by "+gn; var divHolder = document.getElementById('ChartDiv3'); chart3.create(divHolder); } Quote Link to comment Share on other sites More sharing options...
0 JuanC Posted April 7, 2014 Report Share Posted April 7, 2014 You are passing strings in the calls to data.setItem instead of numbers, please try this data.setItem(0, j, Number(posa[j])); data.setItem(1, j, Number(nega[j])); Also, possibly a typo when creating the simplified sample, you are not using neg when splitting into nega. Finally, you can remove the recalculateScale call as it is not needed. JuanC Quote Link to comment Share on other sites More sharing options...
0 uberphoebe Posted April 8, 2014 Author Report Share Posted April 8, 2014 Exactly the problem. Thankyou Quote Link to comment Share on other sites More sharing options...
Question
uberphoebe
I am drawing a bar graph and the max value is "9". Three value 9,0,3
The y scale is showing 100.....
If I switch max scale to 9 it works but autoscaling (which I want) is going wonky,
Any ideas....please?
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
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.