When I want to use Area series with my own color on chart with hidden legend then it crashes with NullReferenceException.
Code to reproduce issue:
Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
TChart chart = new TChart();
chart.Parent = this;
chart.Legend.Visible = false; // !
DataTable dt = new DataTable("tab1");
dt.Columns.Add("X", typeof(double));
dt.Columns.Add("Y", typeof(double));
dt.Rows.Add(1d, 100d);
dt.Rows.Add(2d, 20d);
//Line s = new Line(); // Line is OK
Area s = new Area(); // Area with s.Color = Color.Green and chart.Legend.Visible = false crashes !
s.Color = Color.Green; // !
s.XValues.DataMember = "X";
s.YValues.DataMember = "Y";
s.DataSource = dt;
chart.Series.Add(s);
}
Code: Select all
w Steema.TeeChart.Styles.Custom.DrawPoint(Boolean drawOldPointer, Int32 valueIndex, Int32 x, Int32 y)
w Steema.TeeChart.Styles.Custom.DrawValue(Int32 valueIndex)
w Steema.TeeChart.Styles.Custom.DoDrawIndex(Int32 Index, Boolean CanID)
w Steema.TeeChart.Styles.Series.Draw()
w Steema.TeeChart.Styles.Custom.Draw()
w Steema.TeeChart.Styles.Series.DrawSeries()
w Steema.TeeChart.Chart.DoDraw(Graphics3D g, Int32 First, Int32 Last, Int32 Inc)
w Steema.TeeChart.Chart.DrawAllSeries(Graphics3D g)
w Steema.TeeChart.Chart.InternalDraw(Graphics g, Boolean noTools)
w Steema.TeeChart.Chart.InternalDraw(Graphics g)
w Steema.TeeChart.TChart.Draw(Graphics g)
w Steema.TeeChart.TChart.OnPaint(PaintEventArgs pe)
w System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
w System.Windows.Forms.Control.WmPaint(Message& m)
w System.Windows.Forms.Control.WndProc(Message& m)
w System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)