Recent

Author Topic: TChart from datas create a new chartseries  (Read 408 times)

eldonfsr

  • Hero Member
  • *****
  • Posts: 591
TChart from datas create a new chartseries
« on: April 05, 2026, 06:31:47 pm »
HI i trying from datas receive create new type of chart i recived and create line chart but form that datas is possible to create a piechart or polarchart and another what i wannat...
i have chartlistbox i don't what else i need..
Code: Pascal  [Select][+][-]
  1.  
  2. procedure TFormCharts.BitBtn1Click(Sender: TObject);
  3. Var AxisChart: TChart;
  4.     I,It:integer;
  5.     BPie:TPieSeries;
  6.     ToTalesx,Totalesy:Double;
  7.     TListSources:TListChartSource;
  8.     ChartLineSeries1:TlineSeries;
  9.     TASeries:TAreaSeries;
  10. begin
  11.  AxisChart:= TChart.create(nil);
  12.  BPie:= TPieSeries.create(AxisChart);
  13.  TASeries:=TAreaSeries.Create(nil);
  14.  ChartLineSeries1:=TLineSeries.Create(AxisChart);
  15.  ChartLineSeries1.Active:=true;
  16.   for i:=0 to FormMain.ChartCount do begin
  17.       for it:=0 to TLineSeries(ChartListbox1.Series[i]).Source.Count-1 do begin
  18.           ChartLineSeries1.AddXY(TLineSeries(ChartListbox1.Series[i]).Source.Item[it]^.X,TLineSeries(ChartListbox1.Series[i]).Source.Item[it]^.Y);
  19.       end;
  20.  end;
  21.  AxisChart.Parent:= PanelChart;
  22.  AxisChart.Visible:=true;
  23.  end;
  24.  
  25.  
Show empty chart...
what i need to do this thanks for any help...
I attached image of my time design and run time..

wp

  • Hero Member
  • *****
  • Posts: 13578
Re: TChart from datas create a new chartseries
« Reply #1 on: April 05, 2026, 07:54:06 pm »
I don't fully understand what you are trying to achieve. If you want to know how several series types can be created from the same data take a look at the attached sample project. It populates a TListChartSource by random values (button "Get Data"). A click on a "XXXX chart" buttons then creates a bar, line, polar or pie series from these data by using the ListChartSource in the "Source" property. But note that polar and pie series have their own interpretation of the x and y values, therefore I am transforming x and y here to the way needed, and add the transformed values to the series directly. See the comments in the code. It does not always make sense to display a timeseries of data, for example, in a polar or pie chart.

eldonfsr

  • Hero Member
  • *****
  • Posts: 591
Re: TChart from datas create a new chartseries
« Reply #2 on: April 06, 2026, 12:37:16 am »
Great is what i think to do but not  how to use in all chart thank so much...

 

TinyPortal © 2005-2018