|
Axis Labels |
Posted by John Nelson on Aug-03-2018 23:07 |
|
I am trying to remove the axis labels but when I do then the linear scale is affected.
I'll proved two code snippets one that works and one that does not - i need to sue both....
Here is a code snipett that works
String[] yLabels = {"0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"};
if((chartType.equals("cost"))||(chartType.equals("factored")))
{
String[] yLabels2 = {"", "", "", "", "", "", "", "", "", "", ""};
yLabels = yLabels2;
}
c.yAxis().setLinearScale(0.0, 100.0, yLabels);
yLabels = null;
I need one that does not change the linear scale as well...
This does not work...
if((chartType.equals("cost"))||(chartType.equals("factored")))
{
String[] yLabels2 = {"", "", "", "", "", "", "", "", "", "", ""};
c.yAxis().setLabels(yLabels);
}
I've also tries the yLables array with spaces like " " - and it still will not work
Any help removing the labels without affecting the scale? |
Re: Axis Labels |
Posted by John Nelson on Aug-04-2018 05:43 |
|
The big picture is that I'm trying to have a title by usung axis.setTtile("my title")
but not have the axis labels.
I got rid of both by using setColors(textcolor, transparent) - but I do want the title and just the title. |
Re: Axis Labels |
Posted by Peter Kwan on Aug-04-2018 14:51 |
|
Hi John,
If you want to remove the axis labels, just set the label color to transparent. The Axis.setColors allows you to specify 4 colors for the axis stem, axis labels, axis title and axis ticks. If you just specify 2 colors, by default, the axis title color will be set to be the same as the axis label color, so both will become hidden.
https://www.advsofteng.com/doc/cdjava.htm#Axis.setColors.htm
For example, in Java:
c.yAxis().setColors(Chart.LineColor, Chart.Transparent, Chart.TextColor, Chart.LineColor);
Hope this can help.
Regards
Peter Kwan |
|