Creating percentile-lines in histograms, hiding x-markers

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

Creating percentile-lines in histograms, hiding x-markers

Post by Marius » Thu Feb 28, 2008 11:57 am

Hi. This is a technical detail question:

I have a Histogram, and onto this I want to add some percentile-lines (plines), say 10, 50 and 90. Thus, I am creating 3 thin bars in separate series and adding each series onto the chart in the following manner:

Code: Select all

Looping this 3 times:
com.steema.teechart.styles.Bar pLine = new com.steema.teechart.styles.Bar();
            pLine.add(histogram.getMaxYValue());
            va[0] = value;
            pLine.getXValues().value = va;
            pLine.setColor(histogram.getColor());
            pLine.getPoint(0).setLabel(String.valueOf(value));
            pLine.setBarWidthPercent(5);
  pLine.getBrush().setStyle(com.steema.teechart.drawing.HatchStyle.PERCENT90);
            pLine.setShowInLegend(false);
            pLine.setCustomHorizAxis(getHistogramPanel().getXAxis());
            getHistogramPanel().getTChart().getChart().addSeries(pLine);
The problem is that the x-axis of the new series overrides my current. This means that I get only 1 internal gridline on the x-axis, and only one tick on it; displaying the x-value of the latter of the 3 added series.

So, quick question; is there any way I can add a Series whithout displaying its x-axis? Or alternatively, add a series but without affecting the current x-axis?

I try to set the Bars' horizontal axis to the existing one but with no luck.

Also, if there are methods in the API for displaying percentiles which I have overlooked I am grateful for hints on this :)

Thanks a million in advance,
Marius

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

Post by Narcís » Fri Feb 29, 2008 10:44 am

Hi Marius,
So, quick question; is there any way I can add a Series whithout displaying its x-axis? Or alternatively, add a series but without affecting the current x-axis?

I try to set the Bars' horizontal axis to the existing one but with no luck.
By default all series are set to left and bottom axes as vertical and horizontal axes respectively. So you shouldn't do anything special for that. Anyway you can force this setting:

Code: Select all

        tChart.getSeries(0).setHorizontalAxis(HorizontalAxis.BOTTOM);
Anyway, if you want a series custom axis being not visible you can do this:

Code: Select all

        tChart.getSeries(0).getCustomHorizAxis().setVisible(false);
Also, if there are methods in the API for displaying percentiles which I have overlooked I am grateful for hints on this
I may not understand what you are trying to achieve but I'd use Line series instead of Bar series for drawing the percentile lines.

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

Post Reply