Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Bar Value Label problem & legend

 Post Reply Post Reply
Author
Fare Daniele View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 Jul 2010
Posts: 119
Post Options Post Options   Quote Fare Daniele Quote  Post ReplyReply Direct Link To This Post Topic: Bar Value Label problem & legend
    Posted: 08 Jan 2016 at 12:57pm
Hi to all,
i have a problem, in a chart with only one serie and bar type, with the value label.
In some chart the value label is showed well, in other chart the label is "cutted" on the top as in this image



As you can see, in the first chart (on the left) the first label is ok, in the second chart the same label is cutted.

my setting (these are only test to learn the use of charts)

Procedure TChartFrame.ImpostaGrafico;
Var S : String;
begin
S:=FirstCharUp(FormatSettings.LongMonthNames[Mese]);
TAdvGDIPChartView1.BeginUpdate;

TAdvGDIPChartView1.Panes.Add;
TAdvGDIPChartView1.Panes[0].Range.RangeFrom:=0;
TAdvGDIPChartView1.Panes[0].Range.RangeTo:=5;
TAdvGDIPChartView1.Panes[0].Legend.Visible:=False;
TAdvGDIPChartView1.Panes[0].AxisMode:=amAxisChartWidthHeight;
TAdvGDIPChartView1.Panes[0].YAxis.AutoSize:=True;
TAdvGDIPChartView1.Panes[0].Title.Text:=S;
TAdvGDIPChartView1.Panes[0].Title.Position:=tTop;
TAdvGDIPChartView1.Panes[0].Title.Alignment:=taCenter;

TAdvGDIPChartView1.Panes[0].Series.Add;
TAdvGDIPChartView1.Panes[0].Series.BarChartSpacing:=20;
TAdvGDIPChartView1.Panes[0].Series[0].ShowValue:=True;
TAdvGDIPChartView1.Panes[0].Series[0].ValueFont.Color:=clMaroon;
TAdvGDIPChartView1.Panes[0].Series[0].ChartType:=ctBar;
TAdvGDIPChartView1.Panes[0].Series[0].AutoRange:=arEnabled;
TAdvGDIPChartView1.Panes[0].Series[0].XAxis.XYValues:=False;
TAdvGDIPChartView1.Panes[0].Series[0].YAxis.AutoUnits:=True;
TAdvGDIPChartView1.Panes[0].Series[0].Minimum:=0;
TAdvGDIPChartView1.Panes[0].Series[0].Maximum:=120000;
TAdvGDIPChartView1.Panes[0].Series[0].AddSinglePoint(Value1);
TAdvGDIPChartView1.Panes[0].Series[0].AddSinglePoint(Value2);
TAdvGDIPChartView1.Panes[0].Series[0].AddSinglePoint(Value3);

TAdvGDIPChartView1.EndUpdate;
end;

Also, even if j setted the serie maximum value to 12000, the Y AXIS arranges the values in automatic mode, but if j comment this line

TAdvGDIPChartView1.Panes[0].YAxis.AutoSize:=True;

j get this (the Y Axis value are not showed well)



Can you help me to solve this situation ??

The last question is for the legend.
I have only one serie with 4-5 bars with a different color, ther's a way to get a legend where i explain the color's meaning in this serie ??
(i.e Green=selling price Red=purchase price Navy=difference selling - purchase price)

Thank's for all

Regards

Daniele
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3465
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 08 Jan 2016 at 2:19pm
For the label issue: You can increase the margin that is used to offset the series and y-values to include spacing for the labels. This can be done with the RangePercentMargin property, but this requires Auto-ranging on series with either arEnabledZeroBased or arCommonZeroBased:

  AdvChartView1.Panes[0].Series[0].AutoRange := arEnabledZeroBased;
  AdvChartView1.Panes[0].Series[0].RangePercentMargin := 10;

It's is by design that the width of the Y-Axis is defaulted to the Size property when the AutoSize property is set to False. Please either set the AutoSize to true, or specify a larger width with the Size propery on Y-Axis level.

There is no separate legend for each bar, but a possible solution is to add an invisible pie chart that shows the legend: 

AdvChartView1.Panes[0].Series[0].Visible  := False;
AdvChartView1.Panes[0].Series[0].Pie.LegendVisible := True; 

The pie has a separate legend that show each point. The points for the additional pie will need to be identical to the bar chart.

Kind Regards, 
Pieter

Back to Top
Fare Daniele View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 Jul 2010
Posts: 119
Post Options Post Options   Quote Fare Daniele Quote  Post ReplyReply Direct Link To This Post Posted: 08 Jan 2016 at 3:24pm
Hi Pieter,
thank's for your reply.
The first "problem" now is solved with your help.

About the serie legend i solved the case, due the fact i have 12 frame with 12 charts, with a panel and, inside the panel, there's a colors description.

Thank's again

Have a nice weekend

Daniele
Back to Top
Dessbesell Jr Gilberto View Drop Down
New Member
New Member
Avatar

Joined: 14 Aug 2012
Posts: 7
Post Options Post Options   Quote Dessbesell Jr Gilberto Quote  Post ReplyReply Direct Link To This Post Posted: 26 Aug 2016 at 10:39pm
Hi. I Know it's not about the subject but, there is some way to put the value label at the center of the bar?
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8601
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 27 Aug 2016 at 11:48am
The value is now centered with respect to middle of the bar or do you mean centered with respect to height of the bar? If so, there is currently unfortunately not a built-in setting for this, mainly as it can quickly be problematic when the bar height is small.
Back to Top
Dessbesell Jr Gilberto View Drop Down
New Member
New Member
Avatar

Joined: 14 Aug 2012
Posts: 7
Post Options Post Options   Quote Dessbesell Jr Gilberto Quote  Post ReplyReply Direct Link To This Post Posted: 01 Sep 2016 at 3:37pm
Look at this:

The value 67.98, in the first column, refers to the red bar, but it seems to refer to the orange bar. I think the interpretation would be more natural if the value were inside the bar.

Anyway, thanks for help.
Back to Top
Dessbesell Jr Gilberto View Drop Down
New Member
New Member
Avatar

Joined: 14 Aug 2012
Posts: 7
Post Options Post Options   Quote Dessbesell Jr Gilberto Quote  Post ReplyReply Direct Link To This Post Posted: 01 Sep 2016 at 3:42pm
The image that did not show up in the last post:

Back to Top
Dessbesell Jr Gilberto View Drop Down
New Member
New Member
Avatar

Joined: 14 Aug 2012
Posts: 7
Post Options Post Options   Quote Dessbesell Jr Gilberto Quote  Post ReplyReply Direct Link To This Post Posted: 02 Sep 2016 at 8:56pm
I made some simple changes in the source code to do that with the values and the legend:

Would you like to take a look at the code to, maybe, incorporate these changes?
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3465
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 05 Sep 2016 at 8:37am
Hi, 

You can alsways send us your changes so we can investigate this here and see if we can add this feature
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down