Unable to give Box series names on x-axis

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Marius
Newbie
Newbie
Posts: 44
Joined: Thu Jan 31, 2008 12:00 am

Unable to give Box series names on x-axis

Post by Marius » Wed Mar 05, 2008 2:42 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Mar 05, 2008 2:50 pm

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!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Marius
Newbie
Newbie
Posts: 44
Joined: Thu Jan 31, 2008 12:00 am

Post by Marius » Wed Mar 05, 2008 3:11 pm

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?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Mar 05, 2008 3:26 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Marius
Newbie
Newbie
Posts: 44
Joined: Thu Jan 31, 2008 12:00 am

Post by Marius » Wed Mar 05, 2008 4:14 pm

I use 1.0.1.830. Anyways, I will look further into it to see whats up.

Thanks for the help

Marius
Newbie
Newbie
Posts: 44
Joined: Thu Jan 31, 2008 12:00 am

Post by Marius » Wed Mar 05, 2008 4:27 pm

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]);

Post Reply