Page 1 of 1

Creating percentile-lines in histograms, hiding x-markers

Posted: Thu Feb 28, 2008 11:57 am
by 7667185
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

Posted: Fri Feb 29, 2008 10:44 am
by narcis
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!