I need to show a selected part of a chart (overview) in another chart (detailed) of a big data set up to around 17 million data points.
I would like to make something like Google does in the Google financial pages e.g. http://www.google.com/finance?&gl=us&hl ... client=fss The chart-scrollbar can be resized and scrolled through the hole data set which gives the user a pretty good overview of a quite big data set.
I have tried to user TCursorTool in the overview chart for the selection but it does not provide the right functionality as I see it. The BigFlatFile example handles the huge data set perfectly but the scrollbar cannot be resized and there is no overview-chart.
Could you give some suggestions for a solution to this problem?
Show a part of a chart in another
Re: Show a part of a chart in another
Hi Thorring,
Here is a possibility using a TColorBandTool:
Here is a possibility using a TColorBandTool:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Chart2.View3D:=false;
Chart1.Legend.Visible:=false;
Chart2.Legend.Visible:=false;
Series1.FillSampleValues(1000);
Series2.DataSource:=Series1;
Chart2.Draw;
ChartTool1.Axis:=Chart2.Axes.Bottom;
ChartTool1.Gradient.Visible:=True;
ChartTool1.StartValue:=50;
ChartTool1.EndValue:=200;
ChartTool1.StartLine.Active:=true;
ChartTool1.EndLine.Active:=true;
Chart1.Axes.Bottom.SetMinMax(ChartTool1.StartValue, ChartTool1.EndValue);
end;
procedure TForm1.ChartTool1Resized(Sender: TObject);
begin
Chart1.Axes.Bottom.SetMinMax(ChartTool1.StartValue, ChartTool1.EndValue);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Show a part of a chart in another
Hi Thorring,
As an update note that you can use two independent charts, but maybe the TSubChartTool gives you a more compact result.
Here it is a picture of what you can do:
As an update note that you can use two independent charts, but maybe the TSubChartTool gives you a more compact result.
Here it is a picture of what you can do:
- Attachments
-
- test.png (24.98 KiB) Viewed 5372 times
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Show a part of a chart in another
Hi Yeray,
It looks pretty cool but I still struggle with some minor problems. I am not sure about the ChartTool1Resized and where I find it? Further, I do not find the Draw property you are using but only one with parameters (canvas, Rect)? Will Repaint do it?
TSubChartTool looks cool as well, but it is not what I am looking for this time. I need to show up to 6 graphs in the chart with a lot of indications of ‘bad data areas’, spikes, rapid changes in data and so on. It will be too much to show the sub-chart in this mess of indications.
Best regards
Thorring
It looks pretty cool but I still struggle with some minor problems. I am not sure about the ChartTool1Resized and where I find it? Further, I do not find the Draw property you are using but only one with parameters (canvas, Rect)? Will Repaint do it?
TSubChartTool looks cool as well, but it is not what I am looking for this time. I need to show up to 6 graphs in the chart with a lot of indications of ‘bad data areas’, spikes, rapid changes in data and so on. It will be too much to show the sub-chart in this mess of indications.
Best regards
Thorring
Re: Show a part of a chart in another
Hi Thorring,
Here you have a more complete example with TSubChartTool. Note that the ColorBand1Resized event is called when you resize the tool in the chart in the bottom.
Here you have a more complete example with TSubChartTool. Note that the ColorBand1Resized event is called when you resize the tool in the chart in the bottom.
Code: Select all
private
{ Private declarations }
procedure ColorBand1Resized(Sender: TObject);
//...
uses series, TeeTools, TeeSubChart;
var SubChart1: TSubChartTool;
ColorBand1: TColorBandTool;
procedure TForm1.FormCreate(Sender: TObject);
var Chart2: TChart;
i: Integer;
begin
Chart1.View3D:=false;
Chart1.Legend.Visible:=false;
Chart1.Title.Visible:=false;
for i:=0 to 2 do
with Chart1.AddSeries(TAreaSeries.Create(self)) as TAreaSeries do
begin
FillSampleValues(1000);
AreaLinesPen.Visible:=false;
MultiArea:=maStacked;
Transparency:=50;
end;
Chart1.MarginUnits:=muPixels;
Chart1.MarginBottom:=100;
Chart1.MarginLeft:=20;
Chart1.MarginTop:=20;
Chart1.MarginRight:=20;
SubChart1:=Chart1.Tools.Add(TSubChartTool.Create(self)) as TSubChartTool;
Chart2:=SubChart1.Charts.AddChart;
Chart2.View3D:=false;
for i:=0 to Chart1.SeriesCount-1 do
with CloneChartSeries(Chart1[i]) do
begin
ParentChart:=Chart2;
Color:=Chart1[i].Color;
end;
Chart1.Draw;
SubChart1.Charts.Items[0].Left:=Chart1.MarginLeft;
SubChart1.Charts.Items[0].Top:=Chart1.Axes.Bottom.PosAxis + 25;
SubChart1.Charts.Items[0].Width:=Chart1.Width - Chart1.MarginRight - Chart1.MarginLeft;
SubChart1.Charts.Items[0].Height:=Chart1.Height - SubChart1.Charts.Items[0].Top;
ColorBand1:=Chart2.Tools.Add(TColorBandTool.Create(self)) as TColorBandTool;
ColorBand1.Axis:=Chart2.Axes.Bottom;
ColorBand1.StartValue:=50;
ColorBand1.EndValue:=200;
ColorBand1.StartLine.Active:=true;
ColorBand1.EndLine.Active:=true;
ColorBand1.OnResized:=ColorBand1Resized;
ColorBand1.Transparency:=50;
ColorBand1.Pen.Width:=2;
ColorBand1.Pen.Color:=clBlue;
Chart1.Axes.Bottom.SetMinMax(ColorBand1.StartValue, ColorBand1.EndValue);
end;
procedure TForm1.ColorBand1Resized(Sender: TObject);
begin
Chart1.Axes.Bottom.SetMinMax(ColorBand1.StartValue, ColorBand1.EndValue);
end;
- Attachments
-
- test.png (27.97 KiB) Viewed 5352 times
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Show a part of a chart in another
Hi Yeray,
Thanks a lot! - the TSubChartTool will do it.
Best Regards
Henrik Thørring
Thanks a lot! - the TSubChartTool will do it.
Best Regards
Henrik Thørring