This is the discussion forum for OxyPlot.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!

Windows Phone 8 support??

Oystein Bjorke 10 лет назад 0
This discussion was imported from CodePlex

rbriceno wrote at 2014-05-13 20:48:

Hi,

Is Windows Phone 8 really supported? there's a package on nuget for it (http://www.nuget.org/packages/OxyPlot.WP8/) but I dont see any reference on the site nor the documentation, not even a sample. I'm a bit surprised that almost all the platforms are soported and documented but not Windows Phone 8...

if it's supported,can you provide a sample?

Thanks

objo wrote at 2014-05-13 21:17:

The WP8 package is not yet 'official'. I will try to include it it the official build soon. Need help to test and add examples! :-)

rbriceno wrote at 2014-05-15 17:32:

Hi

It's good to hear that, I'm working in a cross platform App and it would be really nice if I can use the same components for the charts in all of them. I don't know if you have a time frame for the next build, hope it's soon. I could give you a hand with some the testing.


Roygar

"Hole Value"

Oystein Bjorke 10 лет назад 0
This discussion was imported from CodePlex

CMC wrote at 2013-02-26 01:57:

Apologies if this has been asked before, I have searched at length, but is there a concept of "hole value" in OxyPlot? This means there is a row of data that exists, but cannot be plotted, and so a data point is created, but is not to be represented on the screen. An example: A series of numbers with text in one (or more) places in the series:

39.934
44.383
banana
39.383
32.393

Instead of "banana", there might be nothing (null) as well. In industrial applications, it might be "I/O Error" or "Bad Data", etc. I want the row containing the unplotable non-numeric to exist in the series as a gap. I could set it to zero, but it is not a zero. In some charting,, you set the value for the data point to a "Hole Value" and thus exists in the series, but no plot is shown on the screen.

Thank you.

objo wrote at 2013-02-26 11:35:

Try to add a null item, a double.NaN value or a DataPoint.Undefined. Which one depends on how you bind to your data.

WPF Example 1 issue

Oystein Bjorke 10 лет назад 0
This discussion was imported from CodePlex

jernejj wrote at 2013-02-17 20:59:

Hi,

I'm writing this application that will need to display a number of line graphs, so I tried to implement something along the lines of your WPF example.

However, the LineSeries() constructor doesn't accept any arguments and the class doesn't seem to have a Points property.

I downloaded OxyPlot through NuGet and am using VS 2012.

What am I missing here?

Thank you in advance.

objo wrote at 2013-02-17 21:06:

Create an OxyPlot.PlotModel and add a OxyPlot.LineSeries to access the Points collection.
The Points collection is not available in the OxyPlot.Wpf.LineSeries wrapper class (in this case, use the ItemsSource property)

jernejj wrote at 2013-02-17 21:28:

Thanks for the quick reply, it brought me to the solution.

There was no OxyPlot.LineSeries, but upon messing around I found OxyPlot.Series.LineSeries. And it has the Points collection.

I now have a basic graph drawn in my application, awesome.

On a completely unrelated note, is using this technique to draw up a bunch of points bad practice performance wise? I have a number of images and am displaying intensities in their pixels, so there will be a lot of points added to each graph.

Syncing trackers in multiple plots (Metro)

Oystein Bjorke 10 лет назад 0
This discussion was imported from CodePlex

thomasstockx wrote at 2013-11-01 12:13:

Hi all,

I'm working with the Oxyplot.Metro version, and have a xaml with 3 plots in the same column.
They all have the same X values. The standard metro plots show a tracker upon mouse down.

I have already overwritten the GetNearestPoint function of the LineSeries to allow returning the Y value of a mouse click, not just the nearest point. My goal is to show a tracker on each of the 3 plots, when there is only a mouse click on one of them. But since the x axes are the same and I know the X value, this should not be so hard.

However, I'm having multiple issues with this.
I've tried:
PlotModel1.MousePressed += (s, e) =>
{
    // Do some stuff to show tracker on Plot2 and Plot3
};
and a lot more stuff in this MousePressed event, however when I debug, the event is never thrown. Probably due to Metro stuff?

I also tried some things like
Plot1.PointerPressed += (s, e) =>
{
    PlotModel2.HandleMouseDown(s, e);
};
But again, debugger never reaches this code. The plots are defined in the XAML, and this code is in the constructor of the cs file behind the XAML.

Could somebody help or explain why this won't work?

Thanks in advance!

Thomas

everytimer wrote at 2013-11-01 18:02:

I'm not sure, but you should try the myLineSeries.MousePressed event instead, and e.Handled at the end. Good luck.

thomasstockx wrote at 2013-11-01 18:21:

I just tried this simple stub:
LineSeries1.MouseDown += (s, e) =>
{
    // some stuff with plot2 and plot3
    e.Handled = true;
};
with a breakpoint in it, but once again it never breaks so the event is never handled.
Why does each of these things (series, plotmodels, plot) have their own mouse-events that never seem to be emitted?
I have really no idea why I can't get this to work, because the code looks rather self-explanatory...

objo wrote at 2013-11-04 07:50:

Are you using the latest version? The mouse events were added quite recently for the 'metro' version.

thomasstockx wrote at 2013-11-04 09:16:

objo wrote:
Are you using the latest version? The mouse events were added quite recently for the 'metro' version.
Oh, seems like I was working with a month old version, my bad. I had no idea they weren't in the metro version yet.
Thanks!

Help: Add point an action button.

Oystein Bjorke 10 лет назад 0
This discussion was imported from CodePlex

1CodePlex wrote at 2013-10-19 20:35:

Hello,
It is possible add new point from the series?
E.g.
public Form1()
        {
            InitializeComponent();
            var plotModel1 = new PlotModel();
            var lineSeries1 = new LineSeries();
            lineSeries1.Points.Add(new DataPoint(1, 1));
            lineSeries1.Points.Add(new DataPoint(2, 2));
            lineSeries1.Points.Add(new DataPoint(3, 3));
            plotModel1.Series.Add(lineSeries1);
            Plot.Model = plotModel1;
        }

  private void button1_Click(object sender, EventArgs e)
        {
          something...
lineSeries1.Points.Add(new DataPoint(4, 4));

        }
Thank you.

everytimer wrote at 2013-10-19 23:34:

I don't quite understand your question, but yes. The only thing that you need to do after adding a new point to a LineSeries is to update the PlotModel:
  private void button1_Click(object sender, EventArgs e)
        {
          something...
lineSeries1.Points.Add(new DataPoint(4, 4));
plotModel1.RefreshPlot(true);
        }

1CodePlex wrote at 2013-10-20 17:09:

But lineSeries1 is local variable and I can't edit it.

everytimer wrote at 2013-10-20 18:22:

Oh, you have to define it in the class scope as a field or a property (it has to be a property if you want to bind it).
            var plotModel1 {get; set,};
            var lineSeries1 = new LineSeries();

public Form1()
        {
            InitializeComponent();
            plotModel1 = new PlotModel();
            lineSeries1.Points.Add(new DataPoint(1, 1));
            lineSeries1.Points.Add(new DataPoint(2, 2));
            lineSeries1.Points.Add(new DataPoint(3, 3));
            plotModel1.Series.Add(lineSeries1);
            //Plot.Model = plotModel1;  --> bind it
            DataContext = this;
        }

  private void button1_Click(object sender, EventArgs e)
        {
          something...
          lineSeries1.Points.Add(new DataPoint(4, 4));
          plotModel1.RefreshPlot(true);
        }
EDIT: I've just realized that you're using WinForms, so ignore the binding part.
Good luck

1CodePlex wrote at 2013-10-20 19:12:

When I want to define property in the class scope, I get Error: "The contextual keyword 'var' may only appear within a local variable declaration".

everytimer wrote at 2013-10-20 20:37:

Then don't use var, use the proper type name, in this case is PlotModel/LineSeries. This kind of questions are not related to OxyPlot, please learn some basics before.

Zoom and Scroll in PlotArea

Oystein Bjorke 10 лет назад 0
This discussion was imported from CodePlex

Firefox360x wrote at 2013-11-05 10:27:

I people. I have a question about zooming and scrolling. My scroll function doesn't work perfectly, but close enough. Instead of the Maximum value i want to change the ActualMaximum, but that one was protected.
        plotBSITotalA.Model.Axes[0].Maximum = hScrollBarA.Value + (plotBSITotalA.Model.Axes[0].ActualMaximum - plotBSITotalA.Model.Axes[0].ActualMinimum);
        plotBSITotalA.Model.Axes[0].Minimum = hScrollBarA.Value;
Ok, here comes the real problem: When i have zoomed in or out, the scroll function doesn't work anymore in that specific plot Area, where has been zoomed. Other plotArea's where isn't zoomed, will work perfectly.

Does somebody know, how I can scroll when I zoomed in??

Tracker default text color

Oystein Bjorke 10 лет назад 0
This discussion was imported from CodePlex

everytimer wrote at 2013-09-14 16:03:

Hello, I've changed some default colors in the source of OxyPlot some time ago and now I need to change the default color of the text displayed inside the tracker. I've been searching for it like 2 hours but I can't find where it is defined. Could objo, or someone tell me where it is? Thank you!

everytimer wrote at 2013-09-16 23:15:

I just needed to add the desired color in the definition of the plot:
Foreground="Black" 

ContextMenu with Command binding not working.

Oystein Bjorke 10 лет назад 0
This discussion was imported from CodePlex

tboloo wrote at 2013-04-18 13:08:

Dear oxyplotters,
I am trying to add the ContextMenu to the plot, and bind some command to it. HEre is my code:
<oxy:Plot Model="{Binding Plot.Model}">
                <oxy:Plot.ContextMenu>
                    <ContextMenu>
                        <MenuItem Command="{Binding Plot.ShotAtCommand}" Header="Shot At"/>
                        <MenuItem Command="{Binding Plot.AddShotCommand}" Header="Add Shot"/>
                    </ContextMenu>
                </oxy:Plot.ContextMenu>
     </oxy:Plot>
however the command are not executing, and (what is more surprising
) I do not get any binding errors, regardless whether I bind to existing or non existing command in the ViewModel. Any help would be appreciated...
Regards,
Bolek.

objo wrote at 2013-04-18 14:31:

The right mouse button click is handled by OxyPlot, this is probably why the context menu is not showing up (and executing the bindings).
I think this is related to issue https://oxyplot.codeplex.com/workitem/9625

tboloo wrote at 2013-04-28 16:57:

objo,
Thank you very much for the answer, however my situation is slightly different - the context menu is shown, only the bindings to the menu item commands are not executed, and any binding errors (i.e. binding to nonexisting commands) are not reported.
Still looking for a way to execute context menu commands...
Regards,
Bolek.

objo wrote at 2013-04-29 13:33:

Can you try replacing the oxy:Plot control by a Canvas? Does the context menu command binding work in that case?

tboloo wrote at 2013-05-02 11:21:

objo,
I managed to get the bindings working. It turned out that ContextMenu DataContext was null, so I implemented a workaround found on StackOverflow which sets the ContextMenu DataContext in Loaded event, as follows:
        private void ContextMenu_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            (sender as ContextMenu).DataContext = this.DataContext;
        }
I don't know if this is the best solution, but it is working :D
Regards,
Bolek.

Text orientation in RectangleAnnotations

Oystein Bjorke 10 лет назад 0
This discussion was imported from CodePlex

JuergenD wrote at 2012-11-28 12:45:

Hi,
is it possible, to add a text orientation feature to the RectangleAnnotation class?
I created a chart like the "horizontal bands example" but in my case with vertical bands and therefore it would be great to have vertical text...

Thank you for all
Best Regards
Juergen 


objo wrote at 2012-12-03 07:52:

I added a "TextRotation" property. Try setting 90 or 270 degrees. The NuGet package will be updated later today, the build machine is currently powered off.


JuergenD wrote at 2012-12-03 14:06:

Thank you very much for your help. 

I downloaded OxyPlot.WindowsForms.2012.4.37.1 from today (Dec, 3rd) but cannot find this new TextRotation property. Is this the correct version or do I have to wait for another one?

Best Regards
Juergen 


objo wrote at 2012-12-03 19:32:

Try version 2012.4.38.1, pushed to NuGet a few moments ago.


JuergenD wrote at 2012-12-04 09:11:

No luck. I installed 2012.4.38.1 and rebuild my project from scratch. But RectangleAnnotation has no TextRotation property. Maybe we are talking about different libraries? I am using the OxyPlot and OxyPlot.WindowsForms in a .NET 4.5 WindowsForms application.

Thanks again for all your help
Best Regards

Juergen 


objo wrote at 2012-12-04 12:57:

Will check this tonight, see how it is supposed to work at

http://www.objo.net/oxyplot/examplebrowser/default.html

select RectangleAnnotations - vertical bands


JuergenD wrote at 2012-12-04 13:03:

Perfect. Exactly how I need it. I am looking forward to see the update on the NuGet server.

Thanks and best regards
Juergen 


objo wrote at 2012-12-04 18:59:

Version 2012.4.38.1 and later should work. I tested in a WinForms 4.5 project without any issues.


JuergenD wrote at 2012-12-05 14:13:

I am using 2012.5.2.1 now and it works fine. Thank you very much...

Can I have a break in a line series?

Oystein Bjorke 10 лет назад 0
This discussion was imported from CodePlex

_Noctis_ wrote at 2013-10-21 06:28:

Assume I have a collection of 10 points.
The first five from the function: Y = X.
The last five from the function Y = 2X.
Is there any way of plotting the line for points 1 to 5, then have a break (as in, don't trace the line from 5 to 6), then continue?

The reason behind this, is I have a collection of points in a line, but I want to be disable some of the connections (for example when the next x-value is far away, or when the next y-value is lower than the prev)

The only workaround i can see is creating a different series, then giving them both the same color, and disabling one of them in the labels or something...

cwevers wrote at 2013-10-21 11:29:

Try adding a DataPoint.Undefined point between the two sets.

If the first point of the second set is invalid (i.e. a point instead of a line) try re-adding the last point of the first set to the second set.

E.g.:

series.Points.Add(new DataPoint(0, 0));
series.Points.Add(new DataPoint(1, 10));
series.Points.Add(new DataPoint(2, 20));
series.Points.Add(new DataPoint(3, 30));
series.Points.Add(new DataPoint(4, 40));

series.Points.Add(DataPoint.Undefined);
series.Points.Add(new DataPoint(4, 40));
series.Points.Add(new DataPoint(5, 50));
series.Points.Add(new DataPoint(6, 60));
series.Points.Add(new DataPoint(7, 70));

_Noctis_ wrote at 2013-10-22 09:02:

Marvelous ...

5 lines of code in the loop logic and this is solved.

Thanks for the help :)

Сервис поддержки клиентов работает на платформе UserEcho