Page 1 of 1

Unable to give Box series names on x-axis

Posted: Wed Mar 05, 2008 2:42 pm
by 7667185
Hello again 8)

I need some help with what might be a very trivial thing: When creating e.g. 9 Box series in the same chart, I want to display text on the X-axis. However, the TCDemo only shows how to do this for one single series, and the approach does not work when having multiple series seemingly. Like if I use the example from TCDemo

Code: Select all

   String[] s = new String[1];
            s[0] = varlabels[i];
            ser.setLabels(new StringList(s));
only the first Box series gets any name, even though this loop runs over all 9 series. If I try to give the last series all the names, in effect

Code: Select all

   String[] s = new String[9];
            s = varlabels;
            lastOfTheSeriesCreated.setLabels(new StringList(s));
,
I only get as many labels on the axis as there are datapoints in the Series. So I get 4 axis-entries by doing it this way...

So, I've been turning the API inside out without finding a solution:

Can anyone help me set text values on the x-axis of my Box chart? Each of the 9 Box series contains 4 datavalues, so when I give the series values I cannot use Series.add(value, text). Also I try to set Series.getXValues().setName(name) but that's no good either...

Thanks in advance
Best regards,
Marius Lunde

Posted: Wed Mar 05, 2008 2:50 pm
by narcis
Hi Marius,

I'm afraid this happens because when using text for X axis labels TeeChart only uses first series text. That's why only first series has a label. To achieve what you request I recommend you to do as in the Axes\Labels\Custom Labels I or Axes\Labels\Custom Labels II examples in TeeChart.Features.jar.

Hope this helps!

Posted: Wed Mar 05, 2008 3:11 pm
by 7667185
Hi NarcĂ­s, thank you very much for the swift reply. In my TeeChartDemo, both Axes/Labels custom I and II do not have proper source code :? The first (which seems the most relevant for me) has no source at all, the second only have TODO's all over the methods hehe

Am I using a deprecated version of the Demo, or am I just plain lost?

Posted: Wed Mar 05, 2008 3:26 pm
by narcis
Hi Marius,

Both examples have full sources for me here using latest TeeChart for Java release announced here. Which exact version are you using?

Anyway, you should find those examples sources at \Examples\Features\src\features\axes.

Posted: Wed Mar 05, 2008 4:14 pm
by 7667185
I use 1.0.1.830. Anyways, I will look further into it to see whats up.

Thanks for the help

Posted: Wed Mar 05, 2008 4:27 pm
by 7667185
Sweet, I found the source in the folder you specified :D

The following worked

Code: Select all

            AxisLabelsItems items = getXAxis().getCustomLabels();
            items.clear();

        loop:
            AxisLabelItem item;
            item = items.add((double)(i), varlabels[i]);