Page 1 of 1
Scatter Chart : Axis Intersect
Posted: Tue Nov 17, 2015 11:38 am
by 16071129
We need to develop scatter chart as shown in below screenshot:
- Excel Scatter Chart Example
- Excel Scatter Chart.png (16.49 KiB) Viewed 7229 times
In TeeChart we used Points series to achieve the same, but we are not getting the desired result as shown in above screenshot.
- TeeChart Scatter Chart 1
- Scatter Chart Error.png (24.45 KiB) Viewed 7226 times
By manually setting teechart properties using TeeChart Editor, it is possible to achieve desired result as shown in below screenshot:
- TeeChart Scatter Chart 2
- Scatter Chart.png (25.39 KiB) Viewed 7231 times
But we need to achieve the same programmatically at run time (instead of design time) by setting the axis relative position according to (0,0) coordinates.
Re: Scatter Chart : Axis Intersect
Posted: Tue Nov 17, 2015 1:14 pm
by Christopher
Quant wrote:But we need to achieve the same programmatically at run time (instead of design time) by setting the axis relative position according to (0,0) coordinates.
I think the code you need you should already have in the following method:
Code: Select all
private void InitializeComponent()
which is in the e.g. Form1.Designer.cs unit. That is to say that all changes to TChart made by the Chart Editor are written to the InitializeComponent() by the Visual Studio designer.
Re: Scatter Chart : Axis Intersect
Posted: Wed Nov 18, 2015 5:05 am
by 16071129
I think the code you need you should already have in the following method:
Code: Select all
private void InitializeComponent()
Hi Christopher,
This is not as required. Nevertheless we found the way to solve this programmatically. We added following code snippet which solve our problem:
Code: Select all
ColorLine vertiColorLine = new ColorLine(tChart1.Chart);
vertiColorLine.Axis = tChart1.Axes.Left;
vertiColorLine.Value = 0;
vertiColorLine.AllowDrag = false;
ColorLine horizColorLine = new ColorLine(tChart1.Chart);
horizColorLine.Axis = tChart1.Axes.Bottom;
horizColorLine.Value = 0;
horizColorLine.AllowDrag = false;
this.tChart1.Axes.Left.AxisPen.Visible = false;
this.tChart1.Axes.Left.MinorTicks.Visible = false;
this.tChart1.Axes.Left.Ticks.Visible = false;
this.tChart1.Axes.Bottom.AxisPen.Visible = false;
this.tChart1.Axes.Bottom.MinorTicks.Visible = false;
this.tChart1.Axes.Bottom.Ticks.Visible = false;
Check out the final output as shown below:
- Scatter Chart Final.png (23.51 KiB) Viewed 7196 times