|
Formatting Chart (rounding X-Axis Labels, etc.) |
Posted by Philipp on Jul-26-2011 19:15 |
|
Hi,
I use ChartDirector to generate multiple Charts in some ERP Systems. No I have a problem displaying large numbers in the chart. So i hope someone of you can help me:
1. I want to round numbers on x-axis lables. Now, there are 1.800.000 to 2.150.000 displayed, i want to display 1.8 mio to 2.15 mio
2. I only want to show first and last data in diagramm. Because the numbers are to big, and they are overlapping somtimes. I only want to show first value (of Jun 09 = 1.861.234) and last value (2.093.028 of Apr 10), between those only the chart without values.
Hope someone could help me out
|
Re: Formatting Chart (rounding X-Axis Labels, etc.) |
Posted by Peter Kwan on Jul-27-2011 01:07 |
|
Hi Philipp,
For the y-axis labels, you may use Axis.setLabelFormat to configure the formatting. For example, in VB/VBScript, you may use:
Call c.yAxis().setLabelFormat("{={value}/1000000} mio")
For the data point labels, I assume you are currently using Layer.setDataLabelFormat and/or Layer.setDataLabelStyle to enable the labels. Instead of using these two API, you may use Layer.addCustomDataLabel. This allows you to display labels only for certain points.
For example, to display labels for the first and last point, you may use:
Call layer.addCustomDataLabel(0, 0, "{value|.,}", "arial.ttf", 8, &H000000).setAlignment(cd.BottomLeft)
Call layer.addCustomDataLabel(0, Ubound(myData), "{value|.,}", "arial.ttf", 8, &H000000).setAlignment(cd.BottomRight)
Hope this can help.
Regards
Peter Kwan |
Re: Formatting Chart (rounding X-Axis Labels, etc.) |
Posted by Philipp on Jul-27-2011 15:52 |
|
Big Thanks,
Formatting the Axis works well, ive used
if ($maxvalue > 500000) {
$c->yAxis->setLabelFormat("{={value}/1000000} mio");
} else {
$c->yAxis->setLabelFormat("{value|.,}");
}
But formatting the customdatalayer brings up problems:
$b1 = $layer->addCustomDataLabel(0, 0, "{value|.,}", "arialbd.ttf", 11, 0x000000);
$b1->setAlignment(cd.BottomLeft);
works well
but
$b2 = $layer->addCustomDataLabel(0, $countvalues, "{value|.,}", "arialbd.ttf", 11, 0x000000);
$b2->setAlignment(cd.BottomRight);
Does not set alignment to right. Value will overflow over right corner.
Also i tried cd.BottomLeft, there is no difference.... (by the way, why cd.?)
|
Re: Formatting Chart (rounding X-Axis Labels, etc.) |
Posted by Peter Kwan on Jul-28-2011 00:36 |
|
Hi Philipp,
For PHP, the cd.BottomLeft and cd.BottomRight should be BottomLeft and BottomRight instead. Please remove the "cd." part.
Hope this can help.
Regards
Peter Kwan |
|