Page 1 of 1

Unable to change color on Line TeeChart, Version=3.5.3274.30

Posted: Tue Jan 06, 2009 3:20 pm
by 13048149
Hi,

Unable to change color on Steema.TeeChart.Styles.Line after it is initially set.

Used below code to change the color

Code: Select all

        private void line1_DblClick(object sender, MouseEventArgs e)
        {
            line1.Brush.Color = line1.Brush.Color == Color.Green ? Color.Blue : Color.Green;
            Text = string.Format("Line color set to {0}", line1.Brush.Color.Name);
        }
Best Regards
Srinivas Avancha.

Posted: Wed Jan 07, 2009 9:25 am
by narcis
Hi Srinivas,

Code below works fine for me here. Could you please try if it works fine at your end?

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private Steema.TeeChart.Styles.Line line1;

		private void InitializeChart()
		{
			line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			line1.FillSampleValues();
			line1.Color = Color.Green;
			line1.DblClick += new MouseEventHandler(line1_DblClick);			
		}

		void line1_DblClick(object sender, MouseEventArgs e)
		{
			line1.Color = line1.Color == Color.Green ? Color.Blue : Color.Green;
			Text = string.Format("Line color set to {0}", line1.Color.Name);
			line1.Repaint();
		}
Thanks in advance.

Posted: Wed Jan 07, 2009 6:44 pm
by 13048149
Thanks for the solution, it works.