I am trying to add values in
TSquarifiedMapSeries
.Code: Select all
Series1: TSquarifiedMapSeries;
....
Series1.Add(500,'Value1',clGreen);
Series1.Add(250,'Value2',clBlue);
Thanks for your help.
Franck,
TSquarifiedMapSeries
.Code: Select all
Series1: TSquarifiedMapSeries;
....
Series1.Add(500,'Value1',clGreen);
Series1.Add(250,'Value2',clBlue);
Code: Select all
uses Chart, TeeSquarifiedMap;
var Chart1: TChart;
procedure TForm1.FormCreate(Sender: TObject);
var t : Integer;
const numValues=10;
begin
Chart1:=TChart.Create(Self);
Chart1.Parent:=Self;
Chart1.Align:=alClient;
Chart1.View3D:=False;
with TSquarifiedMapSeries(Chart1.AddSeries(TSquarifiedMapSeries)) do
begin
// Add the top-most item
AddItem(-1,0,'Root');
// Add children
for t:=0 to numValues-1 do
AddItem(0,Random(1000),IntToStr(t));
FinishData;
end;
end;
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
The easiest way I can think on is to duplicate the SquarifiedMapSeries; the second one without the root element so it won't be drawn in the chart but can be drawn in the legend.
Try setting
Totalize:=False
before calling FinishData
.Code: Select all
uses Chart, TeEngine, TeeSquarifiedMap;
var Chart1: TChart;
procedure TForm1.FormCreate(Sender: TObject);
var t: Integer;
squari: TSquarifiedMapSeries;
begin
Chart1:=TChart.Create(Self);
Chart1.Parent:=Self;
Chart1.Align:=alClient;
Chart1.View3D:=False;
squari:=TSquarifiedMapSeries(Chart1.AddSeries(TSquarifiedMapSeries));
squari.AddItem(-1,0,'Root');
squari.AddItem(0,200,'ValueA');
squari.AddItem(0,300,'ValueB');
squari.Totalize:=False;
squari.FinishData;
squari.ShowInLegend:=False; // as per default
squari.Marks.Style:=smsLabelPercentValue;
squari.Marks.MultiLine:=True;
with TSquarifiedMapSeries(Chart1.AddSeries(TSquarifiedMapSeries)) do
begin
for t:=1 to Chart1[0].Count-1 do
begin
AddItem(0, squari.Values[t], squari.Labels[t]);
ValueColor[Count-1]:=OperaPalette[t];
end;
ShowInLegend:=True;
end;
end;
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |