ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  setDataLabelStyle question
Posted by Stefan Ohlsson on Feb-11-2013 16:45
Attachments:
Hello!
First I would like to thank you for a great product. We are happy paying customers.

Now to my question. The attached images shows the design of our graphs. The problem we experience is that values of 1 and 2 makes the bars so small that the values are not shown. Is there any way I can set the minimum height of the bars so that if the value is 1 or 2. It will still show the value inside the bar?

XYChart barChart2 = new XYChart(450, 350);
barChart2.setPlotArea(70, 65, 300, 230, -1, -1, Chart.Transparent, 0xc0c0c0);
barChart2.setBackground(0xf5f5f5);
barChart2.xAxis().setColors(0xa1a0a0);
barChart2.yAxis().setColors(0xa1a0a0);
Collections.reverse(mySampleValues);
Collections.reverse(mySampleColors);
Collections.reverse(myBarLabels);
BarLayer layer = barChart2.addBarLayer3(RAMUtil.toDoubleArray(mySampleValues), RAMUtil.toIntArray(mySampleColors));
barChart2.xAxis().setLabels(RAMUtil.toStringArray(myBarLabels));
barChart2.xAxis().setColors(0xa1a0a0);
barChart2.yAxis().setColors(0xa1a0a0);
layer.setDataLabelStyle("Trebuchet_MS.ttf, bold",8,0xffffff);
layer.setBarGap(0.06);
layer.setBorderColor(Chart.Transparent, Chart.softLighting(Chart.Left));
barChart2.swapXY();
barChart2.yAxis().setLabelStyle("Trebuchet_MS.ttf, bold", 8,0xa1a0a0);
barChart2.xAxis().setLabelStyle("Trebuchet_MS.ttf, bold", 8,0xa1a0a0);

Best regards

/Stefan
chartdirectorquestion.png

  Re: setDataLabelStyle question
Posted by Peter Kwan on Feb-12-2013 02:15
Hi Stefan,

Yes. The API is BarLayer.setMinLabelSize. You can use "layer.setMinLabelSize(0);". In this way, the labels is always drawn even if the bar length is 0 pixel.

Hope this can help.

Regards
Peter Kwan