I have a similar situation in which series may be visible or invisible. Once the chart is first viewed, the user may select more series using a context menu, after which control returns to the original chart. What I observe is this:
1) when all the series are removed, then chart reflects this scenario with the "No Data" message. So far, so good.
2) when all the series are added, the chart paints and shows the x and y axis, legend, and so on, but none of the individual lines show up.
The plot does show when the data is initially loaded using InitPlot. The relevant methods are below. Am I missing another call to setup the Chart on a repaint? Thoughts?
Thanks, BobT
private void Reset() { MyChart.Series.Clear(); } private void Refresh() { MyChart.Refresh(); }
private void ChartMenuItem_Click(object sender, RoutedEventArgs e) { HeaderedItemsControl hic = (HeaderedItemsControl) sender; if (hic.Header.Equals("Select Curve")) { SelectCurveFamilyDialog scfd = new SelectCurveFamilyDialog(); scfd.DataContext = new CurveFamilyDataSet(GetPlot().CurveFamilies); if (scfd.ShowDialog() == true) { // refresh plot Reset(); InitPlot(); Refresh(); } // else? } }
private void InitPlot() { PlotData plot = GetPlot(); if (plot != null) { // spin over visible plot curve families foreach (CurveFamilyData curveFamily in plot.CurveFamilies) { if (curveFamily.IsVisible.BoolValue) { AddCurveFamily(curveFamily); } } InitLegend(); } }