I would like to add a semi-transparent background to some marks on a chart, but keep the font non-transparent. The only setting I find for this is Series.Marks.Transparency, but it does both the background and the font.
Can this be achieved?
Thank you,
Ed Dressel
Series marks with semi-transparent background
Series marks with semi-transparent background
Thanks,
Ed Dressel
Ed Dressel
Re: Series marks with semi-transparent background
Hello,
You could use events to draw the brush with transparency and draw the marks without brush later:
You could use events to draw the brush with transparency and draw the marks without brush later:
Code: Select all
uses Series;
type TChartSeriesAccess=class(TChartSeries);
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=False;
Chart1.Legend.Hide;
with TBarSeries(Chart1.AddSeries(TBarSeries)) do
begin
Marks.Shadow.Hide;
Marks.Transparency:=50;
FillSampleValues;
end;
Chart1.OnBeforeDrawSeries:=SeriesBeforeDraw;
Chart1.OnAfterDraw:=ChartAfterDraw;
end;
procedure TForm1.SeriesBeforeDraw(Sender: TObject);
begin
if (Chart1.SeriesCount>0) and (Chart1[0] is TBarSeries) then
begin
with TBarSeries(Chart1[0]) do
begin
Marks.Brush.Style:=bsSolid;
Marks.Transparency:=50;
Marks.Pen.Hide;
Marks.Font.Color:=clNone;
end;
end;
end;
procedure TForm1.ChartAfterDraw(Sender: TObject);
begin
if (Chart1.SeriesCount>0) and (Chart1[0] is TBarSeries) then
with TBarSeries(Chart1[0]) do
begin
Marks.Transparency:=0;
Marks.Brush.Clear;
Marks.Pen.Show;
Marks.Font.Color:=clBlack;
TChartSeriesAccess(Chart1[0]).DrawMarks;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |