Bar Value Label problem & legend

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

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

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

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?

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.

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.

The image that did not show up in the last post:

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?

Hi, 


You can alsways send us your changes so we can investigate this here and see if we can add this feature