I'm trying to hide values in an horizontal bar chart. I tried to set the color to clNone or to use the SetNull function, both hide the bar but leave the label and the space in the bar. I'd like a way to completely hide the value from the chart and I don't want to delete it.
Bruno
How do I hide values in an Horizontal Bar chart?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Bruno,
It works fine for me here using the code below. The bar space can not be hidden as it depends on each bar Y value but you can use each Y value for more than one bar. To have the label not being drawn set LabelStyle as here:
It works fine for me here using the code below. The bar space can not be hidden as it depends on each bar Y value but you can use each Y value for more than one bar. To have the label not being drawn set LabelStyle as here:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.AddXY(3,1,'',clTeeColor);
Series1.AddXY(5,2,'',clNone);
Series1.AddXY(7,2,'',clTeeColor);
Series1.AddXY(5,3,'',clNone);
Chart1.Axes.Left.LabelStyle:=talMark;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
I tried it here, and it didn't work - maybe I'm missing something, I've got three horizontal bar spaces, and only two had bars?
This doesn't work if you try to hide the values after they are added. Try this, in the OnClickSeries event of the chart (add data with FillSampleValues):
This will hide the bar, but won't change the axis
Bruno
This doesn't work if you try to hide the values after they are added. Try this, in the OnClickSeries event of the chart (add data with FillSampleValues):
Code: Select all
procedure TForm1.Chart1ClickSeries(Sender: TCustomChart; Series: TChartSeries;
ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
Series1.SetNull(ValueIndex);
end;
Bruno
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Bruno,
Then you may try to do something like in the All Features\Welcome!\Chart Styles\Financial\Candle (OHLC)\Axis Labels no Weekends example at TeeChart features demo. You'll find the demo at TeeChart's program group.
Then you may try to do something like in the All Features\Welcome!\Chart Styles\Financial\Candle (OHLC)\Axis Labels no Weekends example at TeeChart features demo. You'll find the demo at TeeChart's program group.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
This still doesn't work. It hides the label, but doesn't redraw the axis. What I want is to hide the value and also redraw the chart, so there is no blank space it it.
For example, I have 10 values in the horizontal bar chart. If I hide the 4th value, I don't want to have 3 bars, a space and another 6 bars. I want to have a new chart with 9 values, no spaces. I don't want to delete the value, as it can be shown again.
Bruno
For example, I have 10 values in the horizontal bar chart. If I hide the 4th value, I don't want to have 3 bars, a space and another 6 bars. I want to have a new chart with 9 values, no spaces. I don't want to delete the value, as it can be shown again.
Bruno
Hi Bruno,
there's not an automatic way to hide the Bar and remove the space.
The only way that I can think of is by deleting the datapoint or adding the points again to your Series, you could create a new Series, copy or add all the points except the ones you want to hide and then exchange the Series by the one which is displayed.
there's not an automatic way to hide the Bar and remove the space.
The only way that I can think of is by deleting the datapoint or adding the points again to your Series, you could create a new Series, copy or add all the points except the ones you want to hide and then exchange the Series by the one which is displayed.
Pep Jorge
http://support.steema.com
http://support.steema.com