Quantcast
Channel: OxyPlot (moved to GitHub)
Viewing all articles
Browse latest Browse all 2061

New Post: Trouble getting plot to refresh

$
0
0
My xaml defining my plot.
<Grid Style="{StaticResource ContentRoot}">
        <oxy:Plot x:Name="CloudLayerPlot" Model="{Binding CloudLayerPlotModel}" Width="600" Margin="0,0,0,0" />
    </Grid>
Some of the code behind this XAML page.
    public PlotModel CloudLayerPlotModel { get; set; }

    public cloudDetectionGraph()
    {
        InitializeComponent();
        DataContext = this;
    }
I then call this code:
        makeCloudLayerPlotModel();
private void makeCloudLayerPlotModel()
        {
            var end = new DateTime();
            end = DateTime.Now;

            var start = new DateTime();
            start = end.AddDays(-1);

            // Create data collection
            var data = new Collection<DateValue>();
            var date = start;

           // Other code here - removed as it's quite long

            plotModel1.Series.Add(lineSeries1);
            plotModel1.Series.Add(lineSeries2);
            plotModel1.Series.Add(lineSeries3);
            plotModel1.Series.Add(lineSeries4);
            CloudLayerPlotModel = plotModel1;
            CloudLayerPlotModel.RefreshPlot(true);
        }
I've tried using RefreshPlot() in different places, ie. after when I call my function to make the plotmodel. I've also tried using invalidateplot() but no joy there either. Sure it's something i'm just overlooking!

When I call this function the first time, the plot is drawn correctly, subsequent calls don't though.

Viewing all articles
Browse latest Browse all 2061

Trending Articles