Hi All,
My TChart control is hosted on top of a Panel. That Panel is docked.Fill but the TChart control is Anchored to Left, Top and right.
I have 100 fastline data series and each are having its own custom axis.
At any time i am showing only 5 custom axises.
The size of the custom axises are calculated as below -
int CustomAxisSize = Panel.Height/5;
//1st Custom Axis
CustomAxis.IStartPos = 0;
CustomAxis.IEndPos = CustomAxisSize;
//2nd Custom Axis
CustomAxis.IStartPos = CustomAxisSize;
CustomAxis.IEndPos = CustomAxisSize * 2;
--
--
--
Now, a big area of the TChart control is in the Panel scrollable region.
Thats is absolutely fine.
What i wanted to do is -
Draw a ColorBand tool and associate that ColorBand tool with the Vertical custom axises with alternative colors (for example Gray and white). So that User can identify the different custom axises clearly. It is similar to the GridBand tool. I dont know whether i should use GridBand or not as TChart controls grid line property is set to not visible in my application.
Please suggest how can i achieve that.
Regards,
Avijit
Drawing ColorBand tool
Re: Drawing ColorBand tool
Solved the problem using rectagle tool
Regards,
Avijit
Regards,
Avijit
Re: Drawing ColorBand tool
Hi Avijit,
Yes, rectangle tool would be a solution. Here you have an example of another one, using ColorBand tools:
Yes, rectangle tool would be a solution. Here you have an example of another one, using ColorBand tools:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Axes.Bottom.Grid.Visible = false;
tChart1.Panel.MarginLeft = 7;
int nSeries = 5;
for (int i = 0; i < nSeries; i++)
{
new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
tChart1[i].FillSampleValues();
tChart1.Axes.Custom.Add(new Steema.TeeChart.Axis());
tChart1[i].CustomVertAxis = tChart1.Axes.Custom[i];
tChart1.Axes.Custom[i].StartPosition = (100 / nSeries) * i;
tChart1.Axes.Custom[i].EndPosition = (100 / nSeries) * (i + 1);
tChart1.Axes.Custom[i].AxisPen.Color = tChart1[i].Color;
tChart1.Axes.Custom[i].Grid.Visible = false;
Steema.TeeChart.Tools.ColorBand tmpColorBand = new Steema.TeeChart.Tools.ColorBand(tChart1.Chart);
tmpColorBand.Axis = tChart1.Axes.Custom[i];
tmpColorBand.Color = tChart1[i].Color;
tmpColorBand.Transparency = 80;
tmpColorBand.Pen.Visible = false;
}
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
tChart1.Draw();
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
for (int i = 0; i < tChart1.Tools.Count; i++)
{
if (tChart1.Tools[i] is Steema.TeeChart.Tools.ColorBand)
{
Steema.TeeChart.Tools.ColorBand tmpColorBand = tChart1.Tools[i] as Steema.TeeChart.Tools.ColorBand;
tmpColorBand.Start = tChart1.Axes.Custom[i].Maximum;
tmpColorBand.End = tChart1.Axes.Custom[i].Minimum;
}
}
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Drawing ColorBand tool
Hi Yerey,
I tried your code to use ColorBand tool instead of rectangle tool.
I am able to draw the color band tool but one problem i am facing is -
All my custom axises are having .1% of Minimum and Maximum offset (in Pixels).
Thats why i think the Color band tools height is also getting little reduced.
Please let me know how can i make it in such a way so that the height of the color band dont get reduced.
Regards,
Avijit
I tried your code to use ColorBand tool instead of rectangle tool.
I am able to draw the color band tool but one problem i am facing is -
All my custom axises are having .1% of Minimum and Maximum offset (in Pixels).
Thats why i think the Color band tools height is also getting little reduced.
Please let me know how can i make it in such a way so that the height of the color band dont get reduced.
Regards,
Avijit
Re: Drawing ColorBand tool
Hi Avijit,
I've added 10 pixels of offset in the custom axes of the example above and I think I've seen what you mean.
I've solved it changing the code at OnAfterDraw event so that the ColorBands include the offset too:
I've added 10 pixels of offset in the custom axes of the example above and I think I've seen what you mean.
I've solved it changing the code at OnAfterDraw event so that the ColorBands include the offset too:
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Axes.Bottom.Grid.Visible = false;
tChart1.Panel.MarginLeft = 7;
int nSeries = 5;
for (int i = 0; i < nSeries; i++)
{
new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
tChart1[i].FillSampleValues();
tChart1.Axes.Custom.Add(new Steema.TeeChart.Axis());
tChart1[i].CustomVertAxis = tChart1.Axes.Custom[i];
tChart1.Axes.Custom[i].StartPosition = (100 / nSeries) * i;
tChart1.Axes.Custom[i].EndPosition = (100 / nSeries) * (i + 1);
tChart1.Axes.Custom[i].AxisPen.Color = tChart1[i].Color;
tChart1.Axes.Custom[i].Grid.Visible = false;
tChart1.Axes.Custom[i].MinimumOffset = 10;
tChart1.Axes.Custom[i].MaximumOffset = 10;
Steema.TeeChart.Tools.ColorBand tmpColorBand = new Steema.TeeChart.Tools.ColorBand(tChart1.Chart);
tmpColorBand.Axis = tChart1.Axes.Custom[i];
tmpColorBand.Color = tChart1[i].Color;
tmpColorBand.Transparency = 80;
tmpColorBand.Pen.Visible = false;
}
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
tChart1.Draw();
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
for (int i = 0; i < tChart1.Tools.Count; i++)
{
if (tChart1.Tools[i] is Steema.TeeChart.Tools.ColorBand)
{
Steema.TeeChart.Tools.ColorBand tmpColorBand = tChart1.Tools[i] as Steema.TeeChart.Tools.ColorBand;
tmpColorBand.Start = tChart1.Axes.Custom[i].Maximum + (tChart1.Axes.Custom[i].CalcPosPoint(0) - tChart1.Axes.Custom[i].CalcPosPoint(tChart1.Axes.Custom[i].MaximumOffset));
tmpColorBand.End = tChart1.Axes.Custom[i].Minimum - (tChart1.Axes.Custom[i].CalcPosPoint(0) - tChart1.Axes.Custom[i].CalcPosPoint(tChart1.Axes.Custom[i].MinimumOffset));
}
}
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Drawing ColorBand tool
Hi Yerey,
Your solution worked for me but i found another problem.
Out of 100 fastline series, for 50 series the high and low value are same. Means there is not data change.
In that scenario, the colorband tool is not getting drawn.
Is it a limitation in the color band tool? or i am doing something wrong?
Please let me how to solve this problem.
I am not able to use the rectangle tool because rectangle tool dont accept left, top, width and hight as float values.
Regards,
Avijit
Your solution worked for me but i found another problem.
Out of 100 fastline series, for 50 series the high and low value are same. Means there is not data change.
In that scenario, the colorband tool is not getting drawn.
Is it a limitation in the color band tool? or i am doing something wrong?
Please let me how to solve this problem.
I am not able to use the rectangle tool because rectangle tool dont accept left, top, width and hight as float values.
Regards,
Avijit
Re: Drawing ColorBand tool
Yerey, Please see the images below. For the first image - ColorBandTools are drawn perfectly and alligned with the grid lines (this is very critical to be allingned with the grid line). In the second image you can see, for the series that dont have ny change in data, ColorBandTool is not drawn.
Imgae 1 : Image 2 : Regards,
Avijit
Imgae 1 : Image 2 : Regards,
Avijit
Re: Drawing ColorBand tool
Hi Avijit,
Excuse us for the delayed reply.
I've incremented the number of series in the example I suggested above and, when the chart is too little to show to many series one below the other, the series are drawn like an horizontal line. But I'm still not sure that this is what you are experiencing. So, if that's not the same, could you please send us a simple example project we can run as-is to reproduce the problem here?
Excuse us for the delayed reply.
I've incremented the number of series in the example I suggested above and, when the chart is too little to show to many series one below the other, the series are drawn like an horizontal line. But I'm still not sure that this is what you are experiencing. So, if that's not the same, could you please send us a simple example project we can run as-is to reproduce the problem here?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |