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

Source code checked in, #3dfbe4d18f87

$
0
0
Wpf.Axis: correct default title color (discussions/538914)

Source code checked in, #f7adf5c0373f

$
0
0
MagnitudeAxis: change default position to None

Source code checked in, #dbb7b35c52f5

$
0
0
EllipseAnnotation: change default width/height to NaN

Source code checked in, #191f50136f22

Source code checked in, #6bede36b78cc

$
0
0
InvalidatePlot should always call InvalidateArrange (if the plot is invalidated when it is unloaded, the plot will not be updated next time it is invalidated)

New Post: Axis Titles Not showing up

$
0
0
The default title color for the Wpf.LinearAxis was set to transparent. Should be fixed now! Thanks for the bug report!

New Post: iOS - Can't Add PlotView via AddSubview

$
0
0
I think I found the answer...I do not believe this is a bug, but feedback is welcome.

Take the code in the ExampleBrowser for iOS
private void GraphView(ExampleInfo exampleInfo)
{
    var dvc = new GraphViewController (exampleInfo);
    navigation.PushViewController (dvc, true);
}
What I was attempting to do in my app was to take a UIViewController and add it to a second UIViewController, an allowed operation I believe, by doing the following
private void GraphView(ExampleInfo exampleInfo)
{
    var dvc = new GraphViewController (exampleInfo);
    var newGraphViewController = new UIViewController ();   
    newGraphViewController.AddChildViewController (dvc);
    newGraphViewController.View.AddSubview (dvc.View);
    navigation.PushViewController (newGraphViewController, true);
}
The above produced an empty view, nothing to show on the screen. The reason is, when dvc calls LoadView() the View.Frame of dvc is 0,0,0,0, the frame has no position and no size.

To properly get this to work one needs to manually set the View.Frame of the child UIViewController. The following code works fine:
private void GraphView(ExampleInfo exampleInfo)
{
    var dvc = new GraphViewController (exampleInfo);
    var newGraphViewController = new UIViewController ();
    dvc.View.Frame = newGraphViewController.View.Frame;
    newGraphViewController.AddChildViewController (dvc);
    newGraphViewController.View.AddSubview (dvc.View);
    navigation.PushViewController (newGraphViewController, true);
}
Not a bug, I believe this is as designed by iOS.

New Post: iOS Adding an Axis to Model then Rendering Throws NullReferenceException

$
0
0
See the running example code in the OxyPlot.XamarinIOS Example Browser app in the fork https://oxyplot.codeplex.com/SourceControl/network/forks/benhysell/PlotViewModelIssue

With PlotView unsealed I can now do the following:
public class GraphViewBad : PlotView
    {

        public GraphViewBad ()
        {

        }

        public void BuildGraph()
        {
            Model = new PlotModel ("Bad Plot");
            Model.TitleFontSize = 12;
            Model.TitleFont = "Helvetica";
            Model.TitleFontWeight = FontWeights.Normal;
            Model.TitlePadding = 0;
            Model.Padding = new OxyPlot.OxyThickness (3, 0, 0, 12);
            Model.PlotAreaBackground = OxyColors.White;
            Model.PlotAreaBorderThickness = 0;
            Model.Background = OxyColors.Red;

            //once an axis is added application fails with null ref
            Model.Axes.Add (new LinearAxis (AxisPosition.Left) {
                TickStyle = TickStyle.Outside,
                AxislineStyle = LineStyle.Solid,
                MajorStep = 1, 
                Minimum = 0,
                Maximum = 10
            });
        }
    }
Nothing fancy, a red background with a y-axis...enough to show the error.

When I run this code I get a System.NullReferenceException in PlotElement.cs
/// <summary>
        /// Gets the actual font.
        /// </summary>
        protected internal string ActualFont
        {
            get
            {
                return this.Font ?? this.PlotModel.DefaultFont;
            }
        }
If I change my code to the following the view displays as expected:
public class GraphViewGood : PlotView
    {
        PlotModel model;

        public GraphViewGood ()
        {

        }

        public void BuildGraph()
        {
            model = new PlotModel ("Good Plot");
            model.TitleFontSize = 12;
            model.TitleFont = "Helvetica";
            model.TitleFontWeight = FontWeights.Normal;
            model.TitlePadding = 0;
            model.Padding = new OxyPlot.OxyThickness (3, 0, 0, 12);
            model.PlotAreaBackground = OxyColors.White;
            model.PlotAreaBorderThickness = 0;
            model.Background = OxyColors.Red;

            model.Axes.Add (new LinearAxis (AxisPosition.Left) {
                TickStyle = TickStyle.Outside,
                AxislineStyle = LineStyle.Solid,
                MajorStep = 1, 
                Minimum = 0,
                Maximum = 10
            });
            Model = model;
        }
    }

Commented Unassigned: Poor live data performance [10134]

$
0
0
Based on [this article](https://oxyplot.codeplex.com/discussions/281036) I'm using PlotModel.RefreshPlot(true) frequently to load live data, approximately 20 times per second or so, but the performance is not good. It is sluggish and lags behind.

I have 8 line series with 1000 samples/sec each, but reducing the data frequency does not seem to help much, so this does not seem directly related to drawing performance.

There are a few issues:
* RefreshPlot(true) seems to queue on the GUI thread, probably with BeginInvoke, so that if it runs sluggishly it will also start lagging behind with several seconds in a short time.
* RefreshPlot generally feels very slow for a live data scenario
* The GUI thread is locked for big chunks of the time, so even moving the parent window is very sluggish

I am on a powerful PC with pretty recent CPU and GPU, so that should not be the problem. Running Windows 8, but same is seen on Win7.

I have not yet dug into the source code of Oxyplot, but are there any tips on how to improve live data rendering?
Comments: NO! With your latest change you see lagging in RealtimeDemo again: Try hovering over the menu items, they are not refreshed all the time. Also I don't understand you latest change (rev 822) what should it fix? Could be only a symptom but not the root cause of the issue, I think.

Commented Unassigned: Poor live data performance [10134]

$
0
0
Based on [this article](https://oxyplot.codeplex.com/discussions/281036) I'm using PlotModel.RefreshPlot(true) frequently to load live data, approximately 20 times per second or so, but the performance is not good. It is sluggish and lags behind.

I have 8 line series with 1000 samples/sec each, but reducing the data frequency does not seem to help much, so this does not seem directly related to drawing performance.

There are a few issues:
* RefreshPlot(true) seems to queue on the GUI thread, probably with BeginInvoke, so that if it runs sluggishly it will also start lagging behind with several seconds in a short time.
* RefreshPlot generally feels very slow for a live data scenario
* The GUI thread is locked for big chunks of the time, so even moving the parent window is very sluggish

I am on a powerful PC with pretty recent CPU and GPU, so that should not be the problem. Running Windows 8, but same is seen on Win7.

I have not yet dug into the source code of Oxyplot, but are there any tips on how to improve live data rendering?
Comments: Ok, I see there is more work to do here.. :) The problem was the first example in the WpfExamples application. The plots on the tabs that where initially hidden did not show up until you resized the window. The reverted code fixed this issue. Is there a way to create unit tests with the Plot control? It would be great to cover all these scenarios with threads and loading/unloading by automated tests. I see the update/invalidation process is extremely important for the control to function properly.

Commented Unassigned: Poor live data performance [10134]

$
0
0
Based on [this article](https://oxyplot.codeplex.com/discussions/281036) I'm using PlotModel.RefreshPlot(true) frequently to load live data, approximately 20 times per second or so, but the performance is not good. It is sluggish and lags behind.

I have 8 line series with 1000 samples/sec each, but reducing the data frequency does not seem to help much, so this does not seem directly related to drawing performance.

There are a few issues:
* RefreshPlot(true) seems to queue on the GUI thread, probably with BeginInvoke, so that if it runs sluggishly it will also start lagging behind with several seconds in a short time.
* RefreshPlot generally feels very slow for a live data scenario
* The GUI thread is locked for big chunks of the time, so even moving the parent window is very sluggish

I am on a powerful PC with pretty recent CPU and GPU, so that should not be the problem. Running Windows 8, but same is seen on Win7.

I have not yet dug into the source code of Oxyplot, but are there any tips on how to improve live data rendering?
Comments: @tibel: Should I test with your fork or with just the pull request changes? Regarding the oscilloscope example you are right, but I never expected 5 billion fps so to speak. In my repro sample I am only pushing new data to Oxyplot 20 times per second with a timer, or 20 fps. Even so, with relatively little data I am getting 40 fps measured by Performance Profiling Tools for WPF. I believe I would get 60 fps if no work was done on the GUI thread. The large sample rate of the data channels is merely to stress the rendering engine. More samples equals more stuff to render, which reduces the number of frames per second WPF is able to do. As you say, you usually don't get past 60 fps on a normal PC monitor, however it's not quite that simple. If you continuously move your mouse over the window the measured fps will go through the roof, so I'm not sure how reliable this measurement is in terms of measuring oxyplot performance. Maybe there are other metrics or tools more useful for this scenario? In the end, what matters is how smooth the live data updates appear to the user and how much it affects other GUI updates, such as moving the window or animating something else. To my understanding this comes down to how how long Oxyplot is occupying the GUI thread for every data update as well as per CompositionTarget.Rendering event. I have not yet dug into the Oxyplot code, but out of curiosity what drawing API is being used? We did some vector graphics in our software with seemingly good performance, using low level [DrawingVisual objects](http://msdn.microsoft.com/en-us/library/bb613591%28v=vs.110%29.aspx), but even this can be bested on performance using even lower level APIs. Some relevant discussions: http://stackoverflow.com/a/10572086/134761 http://stackoverflow.com/a/8714107/134761

Commented Unassigned: Poor live data performance [10134]

$
0
0
Based on [this article](https://oxyplot.codeplex.com/discussions/281036) I'm using PlotModel.RefreshPlot(true) frequently to load live data, approximately 20 times per second or so, but the performance is not good. It is sluggish and lags behind.

I have 8 line series with 1000 samples/sec each, but reducing the data frequency does not seem to help much, so this does not seem directly related to drawing performance.

There are a few issues:
* RefreshPlot(true) seems to queue on the GUI thread, probably with BeginInvoke, so that if it runs sluggishly it will also start lagging behind with several seconds in a short time.
* RefreshPlot generally feels very slow for a live data scenario
* The GUI thread is locked for big chunks of the time, so even moving the parent window is very sluggish

I am on a powerful PC with pretty recent CPU and GPU, so that should not be the problem. Running Windows 8, but same is seen on Win7.

I have not yet dug into the source code of Oxyplot, but are there any tips on how to improve live data rendering?
Comments: Where does the issue with samples not rendering show up: - only XAML defined plot - only model defined - both What is the exact problem: - missing model.Update() call - missing model.Render() call - Update() and Render() --> architecture issue :-( If it is the Update() call, this version might work: ``` C# public void InvalidatePlot(bool updateData = true) { this.UpdateModel(updateData); if (this.IsRendering && Interlocked.CompareExchange(ref this.isPlotInvalidated, 1, 0) == 0) { this.BeginInvoke(this.InvalidateArrange); } } ```

Commented Unassigned: Memory Leak in LineSeries [10151]

$
0
0
As described in this discussion:
https://oxyplot.codeplex.com/discussions/532576#post1215810

When LineSeries is bound to rapidly changing data, it can be observed that stale data which is no longer displayed is not being properly garbage collected. This leak is independent of the storage class that is used in the view model layer; the one test case that avoided the memory leak was by binding the line series to an observable collection, and clearing the observable collection prior to each update, however this process is expected to be extremely inefficient.

The attached project is equivalent to the usage within my application, and exhibits the leak. Eventually, the application should throw an OutOfMemoryException (typically within a few hours), although the leak can be observed rather quickly from a memory profiler.
Comments: On additional note, in the included project, DataModel.vb, line 19; the value (currently 100) can be used to increase the rate at which points are added, increasing the rate at which memory is leaked, and reducing the time to get the OutOfMemory exception.

New Post: Question about accessing the plot in MVVM

$
0
0
My plot is created entirely in the view and is bound with data from the view model. When the data sets that are bound, my plot is not refreshing to redraw the data within the correct scale if I zoom or toggle the visibility of a line. So my question is how can I make sure that my graph resets to the correct size when I have zoomed or panned? If I press 'A' to reset the view before I switch the data binding the graph behaves correctly, it is just in the case when I do anything to the graph.

Any help is greatly appreciated and I hope I explained this question thoroughly.

New Post: Printing in WPF with XPS/PrintVisual

$
0
0
I found a solution. I had to call UpdateLayout() before doing the actual printing.

So. If you have a UserControl (mine is called DefaultPrintControl) with some OxyPlot's and some other stuff on them, you can print it like this:
private void ButtonPrint_OnClick(object sender, RoutedEventArgs e)
        {
            var dialog = new PrintDialog();
            if (dialog.ShowDialog() != true)
            { return; }

            var dpc = new DefaultPrintControl();

            dpc.Measure(new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight));
            dpc.Arrange(new Rect(new Point(0, 0), dpc.DesiredSize));
            dpc.UpdateLayout();

            dialog.PrintVisual(dpc, "some description of the print job");
        }

New Post: Color saturation in Oxyplot Column Series

$
0
0
Hi,

I want to generate a Column Series plot with light colors. I think the automatic color generator of Oxyplot generates colors too saturated and dark. Is there a way to define some parameters in order to to that, without the need to define the color manually for each ColumnSeries?

Below, on page 5, is a example of the type of color saturation I would like to have.

TEXT

Created Unassigned: ColumnSeries Not Showing Data [10158]

$
0
0
I am having issue on generating a Column/Bar Chart since upgraded to VS2013. After spending days on searching solution from web and testing, I finally believe it doesn't work in the new OxyPlot package...

Below is the test code. It works when I use the NoPCL.2013.1.51.1 version, however when I replaced the OxyPlot by downloading the latest version from NuGet (version 2014.1.249.1) it shows only an empty chart (only show the axes but no data or no column).

* __View__
```
<Window x:Class="test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:oxy="http://oxyplot.codeplex.com"
Title="MainWindow" Height="350" Width="525">
<Grid>
<oxy:Plot Model="{Binding PivotData}" />
</Grid>
</Window>

```
* __ViewModel__
```
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.Series;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;


namespace test
{
public class MainViewModel : ViewModelBase
{
private ObservableCollection<SalesModel> salesData;
public ObservableCollection<SalesModel> SalesData
{
get { return salesData; }
set { salesData = value; OnPropertyChanged("SalesData"); }
}

private PlotModel pivotData;
public PlotModel PivotData
{
get { return pivotData; }
set { pivotData = value; OnPropertyChanged("PivotData"); }
}

public MainViewModel()
{
GenerateSalesData();
CreatePivotChart();
UpdatePivotData();
}

private void GenerateSalesData()
{
SalesData = new ObservableCollection<SalesModel>();
SalesData.Add(new SalesModel(new DateTime(2013, 11, 1), 12000));
SalesData.Add(new SalesModel(new DateTime(2013, 12, 1), 13000));
SalesData.Add(new SalesModel(new DateTime(2014, 1, 1), 12500));
SalesData.Add(new SalesModel(new DateTime(2014, 2, 1), 14000));
}

private void CreatePivotChart()
{
PivotData = new PlotModel();
PivotData.Title = "Sales Monthly Summary";
}

private void UpdatePivotData()
{
var axisX = new CategoryAxis(AxisPosition.Bottom) { ItemsSource = SalesData, LabelField = "Date" };
PivotData.Axes.Add(axisX);
var axisY = new LinearAxis(AxisPosition.Left) { Title = "USD" };
PivotData.Axes.Add(axisY);
var dataSeries = new ColumnSeries() { ItemsSource = SalesData, ValueField = "Amount" };
PivotData.Series.Add(dataSeries);
}

}

public class SalesModel : ViewModelBase
{
private string date;
public string Date { get { return date; } set { date = value; OnPropertyChanged("Date"); } }

private int amount;
public int Amount { get { return amount; } set { amount = value; OnPropertyChanged("Amount"); } }

public SalesModel(DateTime _date, int _amount)
{
date = new DateTimeFormatInfo().GetAbbreviatedMonthName(_date.Month) + "/" + (_date.Year).ToString();
amount = _amount;
}
}

public abstract class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;

public void OnPropertyChanged(string prop)
{
var pc = PropertyChanged;
if (pc != null)
pc(this, new PropertyChangedEventArgs(prop));
}
}
}

```

New Post: ColumnSeries doesn't show the data

$
0
0
I am having issue on generating a Column/Bar Chart since upgraded to VS2013. After spending days on searching solution from web and testing, I finally believe it doesn't work in the new OxyPlot package...

Below is the test code. It works when I use the NoPCL.2013.1.51.1 version, however when I replaced the OxyPlot by downloading the latest version from NuGet (version 2014.1.249.1) it shows only an empty chart (only show the axes but no data or no column).
  • View
<Window x:Class="test.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:oxy="http://oxyplot.codeplex.com"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <oxy:Plot Model="{Binding PivotData}" />
    </Grid>
</Window>
  • ViewModel
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.Series;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;


namespace test
{
    public class MainViewModel : ViewModelBase
    {
        private ObservableCollection<SalesModel> salesData;
        public ObservableCollection<SalesModel> SalesData
        {
            get { return salesData; }
            set { salesData = value; OnPropertyChanged("SalesData"); }
        }

        private PlotModel pivotData;
        public PlotModel PivotData
        {
            get { return pivotData; }
            set { pivotData = value; OnPropertyChanged("PivotData"); }
        }

        public MainViewModel()
        {
            GenerateSalesData();
            CreatePivotChart();
            UpdatePivotData();
        }

        private void GenerateSalesData()
        {
            SalesData = new ObservableCollection<SalesModel>();
            SalesData.Add(new SalesModel(new DateTime(2013, 11, 1), 12000));
            SalesData.Add(new SalesModel(new DateTime(2013, 12, 1), 13000));
            SalesData.Add(new SalesModel(new DateTime(2014, 1, 1), 12500));
            SalesData.Add(new SalesModel(new DateTime(2014, 2, 1), 14000));
        }

        private void CreatePivotChart()
        {
            PivotData = new PlotModel();
            PivotData.Title = "Sales Monthly Summary";
        }

        private void UpdatePivotData()
        {
            var axisX = new CategoryAxis(AxisPosition.Bottom) { ItemsSource = SalesData, LabelField = "Date" };
            PivotData.Axes.Add(axisX);
            var axisY = new LinearAxis(AxisPosition.Left) { Title = "USD" };
            PivotData.Axes.Add(axisY);
            var dataSeries = new ColumnSeries() { ItemsSource = SalesData, ValueField = "Amount" };
            PivotData.Series.Add(dataSeries);
        }

    }

    public class SalesModel : ViewModelBase
    {
        private string date;
        public string Date { get { return date; } set { date = value; OnPropertyChanged("Date"); } }

        private int amount;
        public int Amount { get { return amount; } set { amount = value; OnPropertyChanged("Amount"); } }

        public SalesModel(DateTime _date, int _amount)
        {
            date = new DateTimeFormatInfo().GetAbbreviatedMonthName(_date.Month) + "/" + (_date.Year).ToString();
            amount = _amount;
        }
    }

    public abstract class ViewModelBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public void OnPropertyChanged(string prop)
        {
            var pc = PropertyChanged;
            if (pc != null)
                pc(this, new PropertyChangedEventArgs(prop));
        }
    }
}

Commented Unassigned: Poor live data performance [10134]

$
0
0
Based on [this article](https://oxyplot.codeplex.com/discussions/281036) I'm using PlotModel.RefreshPlot(true) frequently to load live data, approximately 20 times per second or so, but the performance is not good. It is sluggish and lags behind.

I have 8 line series with 1000 samples/sec each, but reducing the data frequency does not seem to help much, so this does not seem directly related to drawing performance.

There are a few issues:
* RefreshPlot(true) seems to queue on the GUI thread, probably with BeginInvoke, so that if it runs sluggishly it will also start lagging behind with several seconds in a short time.
* RefreshPlot generally feels very slow for a live data scenario
* The GUI thread is locked for big chunks of the time, so even moving the parent window is very sluggish

I am on a powerful PC with pretty recent CPU and GPU, so that should not be the problem. Running Windows 8, but same is seen on Win7.

I have not yet dug into the source code of Oxyplot, but are there any tips on how to improve live data rendering?
Comments: The problem was in WpxExamples/AnnotationDemo on the plots that were initiallly unloaded. This was a XAML defined plot. In this case `isPlotInvalidated == 1` and `InvalidateArrange` is not called after the plot as been loaded. I think this can be solved by setting `isPlotInvalidated = 0` in the `PlotLoaded` event handler. See checked in code.

Created Unassigned: Implement rendering by WriteableBitmapEx [10159]

$
0
0
see
https://oxyplot.codeplex.com/workitem/10134

Viewing all 2061 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>