Sorry! I created a sample application for testing and I know that the answer to the question below is in fact yes - as I suspected! I will have to try and determine what has gone wrong in my production code.......
---------------------------------------------------------------------------------
Hi There
I pretty much have got to a point where the drawlines are doing what I want, but now I have encountered an unexpected problem.
Is it possible to have different drawlineitem objects in the drawline.lines collection draw with different colours? For example I want to make some of the lines green and some of the lines red?
Currently it always redraws all the lines with the same colour (whichever I specify last). For example if I have three drawlineitems in a drawline.lines collection, all three are green. I then want to make the second line red. This code:
mydrawline.lines.item(1).pen.color = color.red
causes all three lines in mydrawline to turn red.
Thanks
Drawlines Again....
Re: Drawlines Again....
Hi rossmc,
As an extra contribution, note that the difference between the drawline.Pen.Color and the drawline.Lines.Pen.Color is that the first is used when you are drawing the line and the second is the color of each drawn line. Here is an example:
As an extra contribution, note that the difference between the drawline.Pen.Color and the drawline.Lines.Pen.Color is that the first is used when you are drawing the line and the second is the color of each drawn line. Here is an example:
Code: Select all
Color[] linecolors;
private void InitializeChart()
{
Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
bar1.FillSampleValues();
linecolors = new Color[4];
linecolors[0] = Color.Red;
linecolors[1] = Color.Blue;
linecolors[2] = Color.Green;
linecolors[3] = Color.Yellow;
Steema.TeeChart.Tools.DrawLine drawline1 = new Steema.TeeChart.Tools.DrawLine(tChart1.Chart);
drawline1.Pen.Color = linecolors[0];
drawline1.NewLine += new Steema.TeeChart.Tools.DrawLineEventHandler(drawline1_NewLine);
}
void drawline1_NewLine(Steema.TeeChart.Tools.DrawLine sender)
{
sender.Lines[sender.Lines.Count - 1].Pen.Color = linecolors[(sender.Lines.Count - 1) % linecolors.Length];
sender.Pen.Color = linecolors[sender.Lines.Count % linecolors.Length];
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |