This question is locked. New answers and comments are not allowed.
Hi, I'm currently trying the charting component in my winform application. (version 2009.1.9.316)
Now I've got just a treeview and a chart component on my winform.
when I click on a treenode the chart view is loaded with the data, everything works fine.
now as long as my treeview isn't reloaded the chart loads the data, but when in my main form is triggered to reload the treeview and I click a treenode, my program crashes. with the following exception:
general exception: at Telerik.Charting.Chart.GetException(RenderEngine renderEngine, Exception ex)
at Telerik.Charting.Chart.GetImage(Int32 width, Int32 height)
at Telerik.Charting.Chart.GetImage()
at Telerik.WinControls.UI.RadChart.GetImage()
at Telerik.WinControls.UI.RadChart.OnPaint(PaintEventArgs e)
in the innerexception I'm reading system.nullreferenceexception
at Telerik.Charting.ChartSeriesItem.set_Parent(ChartSeries value)
at Telerik.Charting.ChartSeriesItem.Clone()
at Telerik.Charting.ChartSeries.CopyItems(ChartSeries originalSeries)
at Telerik.Charting.ChartSeries.CloneSeries()
at Telerik.Charting.RenderEngine.InitializeChartElements()
at Telerik.Charting.Chart.GetImage(Int32 width, Int32 height)
how is this possible? I didn't found anything bizar in my code. I added a try catch around the code that fills the chart, but the error isn't triggered here, but in my main try catch of my program.
my code:
The function TheIO.GetDataChartHistoricMonth or TheIO.GetDataChartHIstoricYear are returning a list of ChartHistoric
Thanks a lot
Now I've got just a treeview and a chart component on my winform.
when I click on a treenode the chart view is loaded with the data, everything works fine.
now as long as my treeview isn't reloaded the chart loads the data, but when in my main form is triggered to reload the treeview and I click a treenode, my program crashes. with the following exception:
general exception: at Telerik.Charting.Chart.GetException(RenderEngine renderEngine, Exception ex)
at Telerik.Charting.Chart.GetImage(Int32 width, Int32 height)
at Telerik.Charting.Chart.GetImage()
at Telerik.WinControls.UI.RadChart.GetImage()
at Telerik.WinControls.UI.RadChart.OnPaint(PaintEventArgs e)
in the innerexception I'm reading system.nullreferenceexception
at Telerik.Charting.ChartSeriesItem.set_Parent(ChartSeries value)
at Telerik.Charting.ChartSeriesItem.Clone()
at Telerik.Charting.ChartSeries.CopyItems(ChartSeries originalSeries)
at Telerik.Charting.ChartSeries.CloneSeries()
at Telerik.Charting.RenderEngine.InitializeChartElements()
at Telerik.Charting.Chart.GetImage(Int32 width, Int32 height)
how is this possible? I didn't found anything bizar in my code. I added a try catch around the code that fills the chart, but the error isn't triggered here, but in my main try catch of my program.
my code:
public partial class HistoricData : Form |
{ |
public IOController TheIO { get; set; } |
public HistoricData() |
{ |
InitializeComponent(); |
} |
public void FillData(List<ChartHistoric> days, string title) |
{ |
try |
{ |
rchrtHistoricData.DataSource = days; |
rchrtHistoricData.ChartTitle.TextBlock.Text = title; |
rchrtHistoricData.PlotArea.XAxis.DataLabelsColumn = "Month"; |
rchrtHistoricData.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = -45; |
rchrtHistoricData.DataBind(); |
}catch(Exception ex) |
{ |
Logging.Log.LogMessageToFile("HistoricData.cs -> FillData(List<ChartHistoric> days): " + ex.Message + ex.StackTrace); |
} |
} |
public void FillTreeView(TreeNode overview) |
{ |
trvMonths.Nodes.Clear(); |
trvMonths.Nodes.Add(overview); |
} |
public void ClearChart() |
{ |
rchrtHistoricData.DataSource = new List<ChartHistoric>(); |
rchrtHistoricData.DataBind(); |
} |
private void trvMonths_AfterSelect(object sender, TreeViewEventArgs e) |
{ |
if(trvMonths.SelectedNode == null) return; |
//ClearChart(); |
//get the selected historic data for this month or whole year. |
//data for the whole year |
if(trvMonths.SelectedNode.Tag.Equals("1")) |
{ |
FillData(TheIO.GetDataChartHistoricYear(), "Month view"); |
} |
if(trvMonths.SelectedNode.Tag.Equals("2")) |
{ |
FillData(TheIO.GetDataChartHistoricMonth(trvMonths.SelectedNode.Text), "Week view"); |
} |
} |
} |
The function TheIO.GetDataChartHistoricMonth or TheIO.GetDataChartHIstoricYear are returning a list of ChartHistoric
public class ChartHistoric |
{ |
public ChartHistoric(string _month, int _days) |
{ |
month = _month; |
days = _days; |
} |
private string month; |
public string Month |
{ |
get { return month; } |
set { month = value; } |
} |
private int days; |
public int Days |
{ |
get { return days; } |
set { days = value; } |
} |
} |
Thanks a lot