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

New Post: Can't programmatically binding to OxyPlot properties

$
0
0
thanks for your quick reply. I tried your solution and in order to get it to work we must use OxyPlot.Wpf.LineSeries (because it a DependencyObject and that is required for DataBinding). I used the following code:
            var ls = new OxyPlot.Wpf.LineSeries();
            var b = new Binding();
            b.Source = mySourceObject;
            b.Path = new PropertyPath("Color");           
            b.Mode = BindingMode.TwoWay;
            ls.SetBinding(OxyPlot.Wpf.Series.ColorProperty, b);

This code compiles perfectly but when I try to add the LineSeries to the model it won't compile:
           PlotModel model
           model.Series.Add(ls)
I get an error telling me that "ls" is the wrong type. It is expecting the non-WPF LineSeries. I have looked for a WPF version of PlotModel but can't find any. Thanks for you help.

New Post: Add Render event and workaround

$
0
0
I fully agree. But then why is there a PlotArea on the model? And although the render itself is not part of the model, it would be very nice if I could at least be notified when the model is being rendered by the control.

New Post: WPF series visibility updates

New Post: make "virtual internal" to "virtual internal protected" to PreTransform and PostInverseTransform Axis baseclass

$
0
0
I was hoping we could get rid of these methods, but I have not found a good way to do this yet. It seems to be convenient to use these methods in the CalculateActualMaximum, CalculateActualMinimum and UpdateTransform methods in the Axis class. So I agree with you, let use change to protected to allow overriding in custom axes!
ps: it is very cool to hear of such advanced use of the library!

Source code checked in, #6809fa35d4d7

$
0
0
Axis: Change the PreTransform and PostInverseTransform methods to protected (discussions/540253)

New Post: Question about accessing the plot in MVVM

$
0
0
The Plot control has an InvalidatePlot method that can be called to invalidate and update the data.
There is also a command binding on the Plot.ResetAxesCommand command (I think this should be refactored to PlotCommands.ResetAxes)
You can also bind to the InvalidateFlag property - when the value is changed the plot is invalidated. I am not sure if this is a good feature, would like to get feedback on this one..
I think it is possible to use an attached property if you want to bind to the actual PlotModel.

Source code checked in, #51c7f059eb73

$
0
0
Wpf: Rename Plot.ResetAxesCommand to PlotCommands.ResetAxes

New Post: Question about accessing the plot in MVVM

$
0
0
The command is changed to PlotCommands.ResetAxes. See example in the "ExportDemo".

New Post: Add Render event and workaround

$
0
0
Did you try setting the Width, Height, AutoAdjustPlotMargins and PlotMargins of the Plot control? If you do this, I think the size of the plot should be fixed.
It is easy to add Rendering/Rendered events to the PlotModel, but I would like to avoid it if it is not really needed.
The PlotModel was meant to be the abstraction of the plot view - so it contains both the "plot area" and all the transforms that are related to the size of the view. See also https://oxyplot.codeplex.com/workitem/10133 which is related to this.

New Post: Add Render event and workaround

$
0
0
What I did was to use the Padding of the PlotModel to make sure that the plotarea itself always has a fixed size. Below is the code that allows a developer to make the width of the PlotArea (thus the plot itself can be larger) exactly the size of RealPlotWidth.
private void UpdatePlotArea(int dispatchCounter = 0)
{
    if (!plot.IsVisible)
    {
        return;
    }

    var plotWidth = plot.ActualWidth;
    if (plotWidth == 0d)
    {
        return;
    }

    var plotModel = plot.Model;
    if (plotModel == null)
    {
        return;
    }

    if (plotModel.PlotArea.Width == 0d)
    {
        if (dispatchCounter < 5)
        {
            Dispatcher.BeginInvoke(() => UpdatePlotArea(dispatchCounter + 1));
        }
        return;
    }

    // Magic constants we need to fix the left and right margins of Oxyplot
    const int RightPadding = 5;
    const int DefaultOxyplotPadding = 8;

    var axisWidth = plotModel.PlotArea.Left - plotModel.PlotAndAxisArea.Left + DefaultOxyplotPadding;

    var leftPadding = plot.ActualWidth - RealPlotWidth - axisWidth - DefaultOxyplotPadding;
    if (leftPadding < 50)
    {
        // Exit, issue with redrawing
        return;
    }

    var padding = new OxyThickness(leftPadding, 0, RightPadding + DefaultOxyplotPadding, 0);
    if (AreEqualOxyThickness(padding, plotModel.Padding))
    {
        return;
    }

    plotModel.Padding = padding;
    plotModel.InvalidatePlot(false);
}

private static bool AreEqualOxyThickness(OxyThickness oxyThickness1, OxyThickness oxyThickness2)
{
    if (oxyThickness1.Left != oxyThickness2.Left)
    {
        return false;
    }

    if (oxyThickness1.Top != oxyThickness2.Top)
    {
        return false;
    }

    if (oxyThickness1.Right != oxyThickness2.Right)
    {
        return false;
    }

    if (oxyThickness1.Bottom != oxyThickness2.Bottom)
    {
        return false;
    }

    return true;
}

New Post: WPF series visibility updates

$
0
0
This sounds like a bug. PlotModel.InvalidatePlot should force the view to redraw.
It should not be necessary to call Plot.UpdateModel (private!) and PlotModel.Update (I think the last one should also be protected in some way).

New Post: WPF series visibility updates

$
0
0
Yep, that's what I thought, but wanted to make sure. You are doing an awesome job so trying to help where I can. Why don't you implement INotifyPropertyChanged for your models. Are you afraid for a performance hit, or is there another reason?

New Post: Can't programmatically binding to OxyPlot properties

$
0
0
No, you cannot add a OxyPlot.Wpf.LineSeries to the OxyPlot.PlotModel. Try adding the "ls" to the Series collection in your OxyPlot.Wpf.Plot control.

Source code checked in, #c67f33c6894c

$
0
0
Wpf: forgot to remove the Plot.ResetAxesCommand

New Post: make "virtual internal" to "virtual internal protected" to PreTransform and PostInverseTransform Axis baseclass

$
0
0
Thanks objo! Saw the code changes got checked in. that was fast!

New Post: WPF series visibility updates

$
0
0
It's mostly because it is a lot of work to support it everywhere (e.g. we would need to subscribe to property changes on elements inside big collections). Remember changing most properties have the potential of a full invalidation of the plot view. Performance is another issue that must be considered (e.g. changing the y-coordinate of 100000 points at the same time). [KISS]

New Post: WPF series visibility updates

$
0
0
I agree that you cannot listen to points (you haven't introduced the updateData bool in the invalidation methods. But I think you can listen to actual properties of axes and series. But as long as the UpdateModel or InvalidateModel redraw it, I am happy.

Remember that I found a workaround so you don't need to feel rushed in any way.

New Post: Add Render event and workaround

$
0
0
objo wrote:
Did you try setting the Width, Height, AutoAdjustPlotMargins and PlotMargins of the Plot control? If you do this, I think the size of the plot should be fixed.
It is easy to add Rendering/Rendered events to the PlotModel, but I would like to avoid it if it is not really needed.
The PlotModel was meant to be the abstraction of the plot view - so it contains both the "plot area" and all the transforms that are related to the size of the view. See also https://oxyplot.codeplex.com/workitem/10133 which is related to this.
Is is possible to fix the width of the x-axis?
For example a plot will display a line series with data that can vary fro 0 to 1000000.
Let's assume we fix the plot width. If the data is within the range 0-10 then the x-axis width will have a certain value. However if we load data in the range between 10000 -100000 then the x-axis width will shrink to accommodate the extra digits displayed on the Y-axis.
It gets even worse if we enable the Y-axis title. (the x-axis shrinks even more.)

In other words rather than fixing the plot width, we need a way of fixing the x-axis width and allow the plot width to move dynamically. Ideally it would be great to anchor the origin of the x-axis as well.

If this is not possible, then having a "rendered" event would allow us to do all the calculations manually to ensure the x-axis has the correct width and location.

Created Unassigned: DateTime axis value overlaped for large data. [10169]

$
0
0
Hi,

DateTime axis value overlapped for large data. Please refer attachment snapshot.

Please suggest solution for it.


Thanks...

New Post: Question about accessing the plot in MVVM

$
0
0
Thank you for the answer this was a big help.
Viewing all 2061 articles
Browse latest View live


Latest Images

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