Jump to content
JChartFX Community
  • 0

Pie is not taking all space if total point value is not 100


Question

I am using Pie chart and setting values for it. I am adding point value as 2, 3, 12, and 5. Pie is rendered but it is assuming total count = 100, and not showing proper round pie. Is there any property available to set total count = 22 instead of 100.

Here is the code:

projectedRunoutPieChart = new cfx.Chart();
var td;
td = new cfx.TitleDockable();
td.setText("Projected Runout");
td.setDock(cfx.DockArea.Bottom);
projectedRunoutPieChart.getTitles().add(td);
projectedRunoutPieChart.getLegendBox().setVisible(false);
projectedRunoutPieChart.setGallery(cfx.Gallery.Pie);
projectedRunoutPieChart.getAllSeries().getPointLabels().setVisible(true);
projectedRunoutPieChart.getView3D().setEnabled(true);
projectedRunoutPieChart.getAllSeries().getPointLabels().setFormat("%T Site(s)");
var myPie;
myPie = (projectedRunoutPieChart.getGalleryAttributes());
myPie.setExplodingMode(cfx.ExplodingMode.All);
myPie.setSliceSeparation(20);
myPie.setMaximumLabelMargin(1);
var data = projectedRunoutPieChart.getData();
data.setSeries(1);
data.setPoints(4);
var series = projectedRunoutPieChart.getSeries().getItem(0);
series.setGallery(cfx.Gallery.Pie);
series.setVolume(100);
projectedRunoutPieChart.getPoints().getItem(0, 0).setColor("#2EFE2E");
projectedRunoutPieChart.getData().setItem(0, 0, 2);
projectedRunoutPieChart.getPoints().getItem(0, 1).setColor("#F00D0D");
projectedRunoutPieChart.getData().setItem(0, 1, 3);
projectedRunoutPieChart.getPoints().getItem(0, 2).setColor("#F6FE0C");
projectedRunoutPieChart.getData().setItem(0, 2, 12);
projectedRunoutPieChart.getPoints().getItem(0, 3).setColor("#DFDFD9");
projectedRunoutPieChart.getData().setItem(0, 3, 5);
var divHolder = document.getElementById('projectedRunoutPiePanel');
if (divHolder) {
    projectedRunoutPieChart.create(divHolder);

Thanks

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Actually I am passing value from GWT code. In GWT code values are Long value. I am not sure what was the cause, but when any of the value is 0, other three are rendered and there was blank for 0 point.

When I used parseInt() in my javaScript function, it works fine now.

Link to post
Share on other sites
  • 0

From google's web site



long: JavaScript has no 64-bit integral type, so long needs special consideration. Prior to GWT 1.5, the long type was was simply mapped to the integral range of a 64-bit JavaScript floating-point value, giving long variables an actual range less than the full 64 bits. As of GWT 1.5, long primitives are emulated as a pair of 32-bit integers, and work reliably over the entire 64-bit range. Overflow is emulated to match the expected behavior. There are a couple of caveats. Heavy use of long operations will have a performance impact due to the underlying emulation. Additionally, long primitives cannot be used in JSNI code because they are not a native JavaScript numeric type.

I will check if we can support gwt long values, in the meantime you will have to use either parseInt or parseFloat depending on the type of your data values.

JuanC

Link to post
Share on other sites

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...