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

Data update in SizeChanged

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

anomistu wrote at 2012-03-05 14:06:

Hi,

Shouldn't "InvalidatePlot()" be called with a "false" parameter in Plot's OnSizeChanged handler?

I think there's no reason to update data when resizing.


objo wrote at 2012-03-05 21:39:

you are right, will fix this soon. thanks!


objo wrote at 2012-03-12 06:30:

corrected in change set 9c07df0f6432

Two - color line series with colored markers

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

amity2001 wrote at 2012-10-23 08:58:

Hello world,

In Two - color line series like different colors for lines, is it possible to show markers also with different colors?

Thanks in advance.

LabelFormatString to display other values other than x/y coordinates

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

michaeldjackson wrote at 2013-07-22 22:16:

I'm plotting points on WPF OxyPlot based on a defined set of point indexes.
For example, I have a file containing two sections:

Section 1 (x, y, width, temperature)
0.00000 8008.00000 303.89111
2.07055 8007.72754 286.60547
4.00000 8006.92822 274.70264
etc


Section 2 (vertexes)
1, 44, 45, 2
2, 45, 46, 3
3, 46, 47, 4
etc

Section 2 tells me in what order to plot the x/y coordinates from Section 1, so the first line in Section 2 says to plot points in line 1, then points in line 44, then points in line 45, then points in line 2 (of Section 1), etc.

I need to use LabelFormatString to display the vertex values, ie 1, 44, 45, 2, etc rather than the x/y coordinates.

Is this possible and how?

MDJ

everytimer wrote at 2013-07-22 22:43:

Is it for the tracker? If it's so you can use "Tag" property of LineSeries and bind it in XAML. See Tracker examples.

Good luck

michaeldjackson wrote at 2013-07-22 23:56:

Thanks for the reply.
Actually, it's NOT for the Tracker. I need to show the Index number for each vertex, AND, hopefully bind it's visibility in XAML to allow user to show/hide it.
If that's not possible, I could resort to the Tracker.

everytimer wrote at 2013-07-23 00:30:

Then why you just do something like this:
for(int i=0; i<s2.Points.Count(); i++)
{
s1.Points.Add(new DataPoint(myList1X[i],myListY[i] );
s1.LabelFormatString = (s2.Points[i].X, s2.Points[i].Y)
}
Please note that I haven't tested this (you would probable need ToString() that).
For disabling that you could put a condition before LabelFormatString and redraw the LineSeries whenever the user clicks on that particular CheckBox. Good luck

Can't get OxyPlot.XamarinAndroid working.

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

Death69 wrote at 2014-05-30 12:30:

Hi there,
I'm trying to make a simple Testapplication that shows some stuff. I'm using the latest Xamarin.Android build and the latest OxyPlot build that i got via nuget. But i always get an
Unhandled Exception:
System.MissingMethodException: Method not found: 'OxyPlot.PlotModel.Update'.
What am i doing wrong?
Here is my source code.
My Model:
using System;
using System.Collections.Generic;
using System.Text;
using OxyPlot;
using OxyPlot.XamarinAndroid;
using OxyPlot.Series;
using OxyPlot.Axes;
using Android.App;
using Android.OS;
namespace OxyPlotTest.Resources
{
    public class MainViewModel
    {
        public PlotModel MyModel { get; set; }

        public MainViewModel()
        {
            // Below from http://oxyplot.org/doc/HelloWpf.html
            //MyModel = new PlotModel("Example 1");
            //MyModel.Series.Add(new FunctionSeries(Math.Cos, 0, 10, 0.1, "cos(x)"));

            // Below from http://oxyplot.codeplex.com/wikipage?title=WpfExample1
            PlotModel temp = new PlotModel("Square wave");
            var ls = new LineSeries("sin(x)+sin(3x)/3+sin(5x)/5+...");
            int n = 10;
            for (double x = -10; x < 10; x += 0.0001)
            {
                double y = 0;
                for (int i = 0; i < n; i++)
                {
                    int j = i * 2 + 1;
                    y += Math.Sin(j * x) / j;
                }
                ls.Points.Add(new DataPoint(x, y));
            }
            temp.Series.Add(ls);
            temp.Axes.Add(new LinearAxis(AxisPosition.Left, -4, 4));
            temp.Axes.Add(new LinearAxis(AxisPosition.Bottom));
            
            MyModel = temp;// this is raising the INotifyPropertyChanged event
        }
    }
}
The Activity:
[Activity(Label = "OxyPlotEx", MainLauncher = true)]
    public class OxyPlotEx : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            MainViewModel MyMainViewModel = new MainViewModel();
            SetContentView(Resource.Layout.OxyPlotEx);
            var plotView = FindViewById<PlotView>(Resource.Id.plotView_Temp);
            plotView.Model = MyMainViewModel.MyModel;
            
        }
    }

objo wrote at 2014-06-06 21:13:

Thanks for reporting a possible bug - I'll try to reproduce this! I cannot see any errors in your Activity class, it looks ok to me.

The Update method was recently removed from the public API because it should not be called by the client apps, only by the PlotView controls.

Death69 wrote at 2014-06-10 12:05:

Hi,
i got the latest commit and build the xamarainandroid and oxyplot .dll's and now it's working. I got OxyPlot via NuGet before. But i had to delete the
<input ="StyleCop...> in OxyPlot.csproj

objo wrote at 2014-06-10 13:41:

Thanks, I will check and update the NuGet packages. I am trying to get the Android and iOS components built on the Windows build server.
Make sure the OxyPlot and OxyPlot.XamarinAndroid packages have the same version number.

objo wrote at 2014-06-11 12:11:

StyleCop is a prerequisite to build the OxyPlot core library (but it is not needed to use the library).

Death69 wrote at 2014-06-11 15:28:

Hi,
as is said i removed it before building the library and it worked.

I may have found a bug, but I'm not sure if it really is one or I'm just don't use it right.
In my project I have a ColumnSeries and i put alot of ColumnItems in it (~50) and it should start from a desired position with the CategoryAxis.StartPosition property but there is nothing drawn in the PlotModel. It actually deletes the hole CategoryAxis. I need to set it to an explicit value from the items i get. I need to show data between specific ages (from 40 to 95) then i need to let it start from 40.

It would be good if the CategoryAxis labels could be invisible, with the amount of ColumnItems i have it looks really ugly, because they're overlaping. Or something like showing every fifth position.

Btw: Great Library, it's really really powerful. Excellent work.

Legend position in PieSeries

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

Patoon wrote at 2013-01-31 14:56:

Hi,
Is there any way to place the legend in an outside box instead of inside the slices ?

Thank you.

objo wrote at 2013-02-07 22:41:

Try to set InsideLabelFormat="" and OutsideLabelFormat = "{1}: {0}"
{0} is replaced by the value, and {1} by the label (legend).

patoon wrote at 2013-02-08 08:17:

Thank you for your answer,
What you propose give labels above corresponding slices, and I try to have label stacked together in a separate box outside of the pie.
Do you think it's possible ?

Thank you.

objo wrote at 2013-02-10 23:00:

Sorry, that is not possible in the current implementation.
It is possible to subclass the PieSeries class and override the Render method to draw the labels. Please share if you implement the feature :)

patoon wrote at 2013-02-11 07:21:

Thanks. I will try in this direction.

How to convert mouse coordinates to X-Y plot coordinates in WindowsForms?

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

funkerkat wrote at 2013-10-15 10:38:

Hi, thanks for lib! I like it but I need help.
Is it possible to get mouse coordinates converted to X-Y plot coordinates? I use OxyPlot lib for WindowsForms. I want to get mouse coordinates X-Y in mouse event handler (MouseClick for example). I know similiar functionality is realized in WPF lib, but as I know tracker is not implemented in WindowsForms.
I'm a newbie, please help me to solve this problem, i'll appreciate any advices! If it needs to modify lib please show me with which classes I should work...

objo wrote at 2013-10-15 15:05:

The axes have inverse transform methods that you can use to convert from mouse coordinates to plot coordinates. See the mouse event examples in the example library!
0

Latest Alpha - Plot's Context Menu

mike 9 years ago 0
Hi, I just updated to the latest Alpha. The problem is that the property ContextMenu cannot be accessed with the new OxyPlot files in WPF. I'm using a context menu for each plot, any idea how to solve this thing? Thanks! Mike

Programmatically add graph to XAML form C#

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

SheDan wrote at 2014-04-08 22:47:

Hello there!
I have to add different graphs in each new tab in TabControl. So I can't just write in XAML something like this:
  <oxy:Plot x:Name="Plot1" Title="A Graph" Model="{Binding PlotModel}">
I tried adding to Canvas using .Children.Add() but it doesn't work >_<

How can I add graph to my form from C# code during the runtime??

everytimer wrote at 2014-04-09 22:16:

Check ANY example.

In ViewModel:
PlotModel.Series.Add(ls);

SheDan wrote at 2014-04-09 22:27:

Oh no! You didn't get it. I have to declare new Plot from the C# code and then add it to Canvas and so on. I mean when I compelling my project there are not Plot blocks at all!

everytimer wrote at 2014-04-10 20:43:

You can add to the Model of your Plot then:
MyPlot1.Model.Series.Add(ls);
You should be using templates and bind a collection of PlotModels to a custom UserControlm

How To Set "Figure Number Text Display" Off

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

hasancan wrote at 2013-02-24 09:27:

Hi

I was using HTMLReportWriter class and I added an image to my html report but I don't want it to display Figure X text. Even though I do not set any text, it displays Figure X by default. I tried setting FigureTextFormatString to blank but nothing changed...

NuGet for WinForms

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

ta wrote at 2012-03-30 13:46:

Hi,

I was wondering if there are plans to add nuget packages for winforms at some point? It would be very much appreciated.


objo wrote at 2012-03-30 14:58:

Yes, I will add a nuget package for winforms.

I would also like to create a comparison of performance on WPF, Silverlight and Winforms (I guess the Winforms implementation will do quite well!)


objo wrote at 2012-04-03 10:03:

I have added the nuget package - see http://nuget.org/packages/OxyPlot.WindowsForms.

Ps. There is a bug when  using the toolbox to add a Plot control to a form, something is wrong with the Model assignment - will solve this later (http://oxyplot.codeplex.com/workitem/9952).


ta wrote at 2012-04-10 10:01:

Thank you so much. I am now using the nuget package.

The only small hick up was that IAxis and ISeries does not seem to be available in the dll from nuget. (maybe they are no longer used? - I did not check the source) I just replaced them with the usage of the interfaces with var's and now it works perfectly.


objo wrote at 2012-04-10 22:51:

Yes, the interfaces (IAxis, ISeries and IAnnotation) were removed. Change to use the Axis, Series and Annotation base classes.