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

Problem creating Line Series dynamically

Oystein Bjorke hace 10 años 0
This discussion was imported from CodePlex

terry_513 wrote at 2014-01-01 11:47:

Hi,
I am using OxyPlot to achieve few line charts using WPF C#.
Using XML :
I had created Logarithmic & Linear axis as Left & Bottom respectively and 5 line series in xml respectively. I assign each line series ItemSource as List<Point> and it works well.

Now I am to create the same thing dynamically,
I could create both axis properly. And for line series, I add it to the PlotModel as below :
    public void AddData(List<List<Point>> data, string title)
    {
        LineSeries lineSeries;
        int ctr = 0;
        foreach (List<Point> set in data)
        {
            ctr++;
            // Setting the itemsource as set i.e. List<Point>
            lineSeries = new LineSeries { StrokeThickness = 5, MarkerSize = 3, Title = title + " " + ctr, ItemsSource = set };
            PlotModel.Series.Add(lineSeries);
        }
    }
With the above code, I get the plot, 5 titles, but no lines - I guess because somehow data is not set to Points of the line. I also tried :
lineSeries.Points = set;
but this could do as it doesn't accept List<Point>

Why is this difference between creating thru XML and code ? Why their are no lines visible ? Do I need to set or pass data in some other format ?

Can anyone please help me.

terry_513 wrote at 2014-01-01 16:20:

I got the solution,
I need to set DataFieldX = "X", DataFieldY = "Y" in my LineSeries along with ItemSource.

Thanks

Adding OxyImage in model

Oystein Bjorke hace 10 años 0
This discussion was imported from CodePlex

BlindMonk wrote at 2013-07-24 14:17:

I want to add a bitmap image to the plot. I have a bitmapimage, which I made from a matrix. I want to know how to add this image to oxyplot? I made scatterseries , but it got too slow.

I made a plotmodel, i am not able to add oxyimage to plotmodel.

I looked at this. But I could not get rendercontext of the model.
Edit:

I made OxyImage and added to model using image annotation:
                model.Annotations.Add(new ImageAnnotation
                {
                    ImageSource = image,
                    X = new PlotLength(.5, PlotLengthUnit.RelativeToPlotArea),
                    Y = new PlotLength(.5, PlotLengthUnit.RelativeToPlotArea),
                    Width = new PlotLength(.5, PlotLengthUnit.RelativeToViewport),
                    Height = new PlotLength(.5, PlotLengthUnit.RelativeToViewport),
                    Opacity = 1,
                    Interpolate = false,

                });
I see the image, but it doesnt zoom or move.

This bitmap is an rgb image created from bytearray.

any input is deeply appreciated.

thanks a lot

BlindMonk wrote at 2013-07-25 16:13:

well, this part is fine. i will post another issue that i am facing. thanks

ECCN code for OxyPlot

Oystein Bjorke hace 10 años 0
This discussion was imported from CodePlex

EmelieEdstrom wrote at 2013-07-02 16:02:

Hi!
For legal reasons we need to know:
What is the ECCN code for OxyPlot?
and Are there any cryptos used?
Regards
Emelie Edström

objo wrote at 2013-07-02 23:16:

There is no code depending on System.Security.Cryptography in OxyPlot.
Sorry, I don't know anything about ECCN codes.

EmelieEdstrom wrote at 2013-08-05 13:20:

Hi again!

I also need to know if any part of the software designed in US or retrieved from a US site?

Regards

Emelie Edström

Från: objo [email removed]
Skickat: tisdag den 2 juli 2013 23:17
Till: Edström Emelie
Ämne: Re: ECCN code for OxyPlot [oxyplot:448830]

From: objo

There is no code depending on System.Security.Cryptography in OxyPlot.
Sorry, I don't know anything about ECCN codes.


objo wrote at 2013-08-07 12:55:

No, there should not be any parts designed in US. This library is made in Norway.

ArrowAnnotation text position

Oystein Bjorke hace 10 años 0
This discussion was imported from CodePlex

tbnguyen1407 wrote at 2013-06-17 00:46:

Hi,

Is it possible to adjust the orientation and position of ArrowAnnotation's Text like that of LineAnnotation. My horizontal ArrowAnnotation's text cannot be seen as it starts from X=0 and the text is fixed behind the tail :(.

Thanks.

objo wrote at 2013-06-18 12:26:

Currently the ArrowAnnotation only support horizontal text.
I have added the issue https://oxyplot.codeplex.com/workitem/10057
0

Refresh Oxyplot Lineview

Daniel Kampert hace 9 años 0
Hello,

I want display some Sensordata with Oxyplot. I have this WPF Code:

<oxy:PlotView x:Name="DataPlot" Model="{Binding PlotModel}" Margin="0,127,0,0"/>

My Oxyplot Class

public PlotModel PlotModel {get; private set;}
public int x = 0;
public MainViewModel()
{
this.SetupModel();
}
public void AddDatapoint(int Plot, double x, double y)
{
lock (PlotModel.SyncRoot)
{
var Series = (LineSeries)PlotModel.Series[Plot];

if (Series.Points.Count >= 200)
{
Series.Points.RemoveAt(0);
}

Series.Points.Add(new DataPoint(x, y));
}
}
private void SetupModel()
{
PlotModel = new PlotModel();
PlotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Minimum = -10, Maximum = 10 });
for (int i = 0; i < 20; i++)
{
PlotModel.Series.Add(new LineSeries { LineStyle = LineStyle.Solid });
}
var dispatcherTimer = new System.Windows.Threading.DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, 50) };
dispatcherTimer.Tick += RefreshPlot;
dispatcherTimer.Start();
}
private void RefreshPlot(object sender, EventArgs e)
{
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(() =>
{
PlotModel.InvalidatePlot(true);
});
}

Now I have my Mainclass and I want to refresh my Plot. So I use this code:

public Window_Plot()
{
this.DataContext = new MainViewModel();
InitializeComponent();
UpdateTimer = new Timer(Timerupdate);
UpdateTimer.Change(Timeout.Infinite, Timeout.Infinite);
UpdateTimer.Change(1000, 20);
}
public void Timerupdate(object source)
{
Grafik.AddDatapoint(0, Counter, 1);
Counter++;
}

But I don´t get any data displayed on my Graph.
Why?

Thank you for help!

0

How to change distance between position tiers axes

Samuel Guedon hace 9 años 0
Hi all,

I have a CandleStickandSerie plot using a category axes as X axis. I use it in order to show a time axis that will erase gaps when the financial markets are closed.

As my step in between major ticks are non linear (it can be monthly, meaning 30 or 31 ticks, not to mention february) i use 2 axes : one for the tick (a simple ' ) and one for the label.

I would like to know how I can move the axes so the distance in between my two tiers is not so wide, and mostly how to "stick" my tick category to the actual axis (= the border of the plot area)?

Thanks in advance.

I think I will put my code later as I think some were interested by such a behavior (deleting gaps for financial series when markets are closed).

0

Show Tooltip for Rectangle Bar Item

Vince hace 10 años 0
Hi Everyone,

I am using Oxyplot to create a real time plotting graph using rectanglebarseries. Oxyplot is great library and having so much functionalities. Thanks for such a wonderful control.

Can anyone please guide me on how to add tooltip for each RectangleBarItem. I understand that this can be done only through RectangleAnnotation by hooking the mouse click events. I used the following code to reach to the datapoint of the clicked location, but not sure how to proceed from there and get the clicked rectangleBarItem and show the tooltip when the mouse is hovered over that object.
            OxyPlot.TrackerHitResult result = series.GetNearestPoint(e.Position, true);            if (result != null) && result.DataPoint != null)
{
DataPoint dataPoint = result.DataPoint;
}
Any help highly appreciated.

Vince

Legends with check boxes

Oystein Bjorke hace 10 años 0
This discussion was imported from CodePlex

jfraschilla wrote at 2014-01-20 16:54:

I would like to create a ChartController for a plot with multiple series. The ChartController would contain items similar to a legend but with a checkbox next to each series. The checkbox would allow the user to toggle the visibility of the series. How should I implement this? How can I display a short segment of the line in a listbox?

objo wrote at 2014-01-27 19:33:

(I edited the title to make it easier to search in the discussion threads)

Check boxes and list boxes are not supported by the OxyPlot core - you need to define these in an overlay.
This should be included in the examples, I have created an issue:
https://oxyplot.codeplex.com/workitem/10122

Android - W/OpenGLRenderer(): Path too large to be rendered into a texture

Oystein Bjorke hace 10 años 0
This discussion was imported from CodePlex

benhysell wrote at 2014-07-13 20:29:

I'm not sure what I'm seeing here, thought I would ask and see if anyone else is seeing this.

Xamarin.Android column series, I setup a value axis with the following parameters:
var valueAxis = new LinearAxis { Position = AxisPosition.Left, MinimumPadding = 0, MaximumPadding = 0.06, Minimum = 260, Maximum = 265 };
The plot does not draw, and I get this in the debug output window:
07-13 14:24:50.911 W/OpenGLRenderer( 3926): Path too large to be rendered into a texture
Oddly, if I back down the Minimum to 100, graph draws fine, but when I do a two finger zoom in the graph fails to draw and the output window starts outputting "Path too large..." errors.

I'm a bit stumped on what is going on here or what I might do to correct it, thoughts?

-ben

while lines between series

Oystein Bjorke hace 10 años 0
This discussion was imported from CodePlex

Adum_264 wrote at 2014-03-17 20:27:

Hey I'm seeing this gaps between my lines:
Image
Image
Do you know what am I doing wrong or if this is a bug?

Thanks.

everytimer wrote at 2014-03-17 23:12:

I've used older versiones of OxyPlot a lot and never experienced that issue. Could you provide the data to test it myself? It seems to me that your data may have duplicate points (or nearly duplicate) there.

Edit: If you have some point that is Undefined or his y-value is NaN you may experience a gap as yours. Are you doing mathematical operations (divisions) with your data?