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

More than two Y-axis

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

benjaminrupp wrote at 2011-10-19 15:57:

Hello,

I am trying to add three y-Axis to a chart Model. But if I display the chart at least two axis are overlapping depending on the axis.Position.

Is there any possibility to relocate an axis?

Best regards

Benjamin


objo wrote at 2011-10-19 19:44:

hi Benjamin, see the "AxesDemo" in the WPF solution. I will add the demo to the ExampleLibrary shortly, then you can also see it in the Silverlight and Windows Forms project.

The "Position" property of the axes sets the position of the axis to left, right, top or bottom of the plot area.

The axes also have "StartPosition" and "EndPosition" properties - these fractions define where the axis starts and ends in the left/right/top/bottom axis areas. 


benjaminrupp wrote at 2011-10-20 08:20:

Dear Objo, 

please see the example of the link below. I am looking for a possibility to display axis like this. At the bottom of the chart there are two axis below each other. If I render the same chart in OxyPlot, then the two axis are overlapping.

http://help.syncfusion.com/ug_93/User%20Interface/WPF/Chart/default.htm?turl=Documents%2F41158chartaxisorientation.htm


objo wrote at 2011-10-20 22:00:

Thanks for the link. I think it is a good idea! (but I am not sure if designers like this kind of look...)

I suggest a 'PositionOffset' property to be added to the Axis class - this will move the position of the axis vertically for a horizontal axis and v.v. It would also be great to have auto positioning of the axis - but this will require more passes in the measure/arrange algorithm.

I add the suggestion to the issue tracker. Also, feel free to create a patch on this feature!

HitTestResult on MouseUp

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

Tech_Junkie wrote at 2012-05-08 16:03:

Currently the MouseDown event includes the HitTestResult element, but the MouseUp (or MouseMove) don't seem to have it. I can also not find in the source if I am mistaken. 

Would it be possible to include the HitTestResult element in the MouseUp event, or is there an easy way of calculating the closest element myself?


objo wrote at 2012-05-11 00:16:

You are right, currently the hit testing is only performed on the mouse down event. Similar code can be added to the mouse up event, will consider adding it later. See the source code for the mouse down event how you can find the closest element, it should be possible to copy/paste the code.

Getting Data From Plot

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

JasonWeise wrote at 2012-11-07 00:47:

Hi

I have a plot with 10 points and need to retrieve the data for the intermediate points from code much like the tracker does when clicking the plot series.

As an example...

I have 10 points making up the data points on a smoothed line series plot.

I need to be able to retrieve the data value for a point at an arbitrary point along the X-Axis (eg X=3.2) that falls on the smoothed plot.

I have looked through the code and cannot find a function that can retrieve this information easily without the user clicking the plot series.

Thanks in advance..

BTW: great plotting package, love it.


objo wrote at 2012-11-07 16:19:

The tracker only finds the nearest point, it does not interpolate. I don't think there is any interpolation functions implemented in the library yet.

But we need to add this for http://oxyplot.codeplex.com/workitem/10017.


JasonWeise wrote at 2012-11-07 19:20:

Hi 

Thanks for the reply.

How can this be the case when, if you click on the smoothed plot curve the tracker gives you an X,Y value that is not in the original data set (ie it is smooth interpolated between the points) 

For example if I have 5 data points in the plot within a smoothed line series and I click anywhere on the series "between" the points I get a value at that point I clicked displayed by the tracker. I want to be able to get that calculated value from the series in code without the user clicking the line series.

If I want the value of the plot 1/6 of the way between the points (2.5,24) and (3.4,35) I need to be able to get this info from the plot without the user having to click 1/6 of the way between the points.


objo wrote at 2012-11-07 19:36:

It finds the *nearest* point, not necessary the point at the x-value of your mouse cursor.

You find the code in OxyPlot\Series\XYAxisSeries.cs method GetNearestInterpolatedPointInternal

Exchange mousebuttons behavior

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

mreu wrote at 2012-10-10 14:28:

H

Is it possible to exchange the behavior of the left and right mouse buttons? So that the left mouse button can be used for panning and zooming. If yes, how can this be done?

Thanks

Michael

 


objo wrote at 2012-10-10 23:09:

hi Michael, this is http://oxyplot.codeplex.com/workitem/9625. Will be fixed later!


cwevers wrote at 2013-10-17 15:18:

Is this fixed already?

objo wrote at 2013-10-17 18:23:

Sorry, not started from my side yet - I am working on some other features that has higher priority.

Oxyplot / WinForms ignores axes definition

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

user78483 wrote at 2013-10-18 00:04:

I do have a question about using Oxyplot in WinForms. The following code should add certain axes to the plot but it does not. If I do not specify Minimum/Maximum for both, it does nothing. If I specify both, the x-axis shows the right ones but the y-axis is wrong. Am I doing something wrong?
pm = new PlotModel("Trigonometric functions", "Example using the FunctionSeries")
   {
      PlotType = PlotType.Cartesian,
      Background = OxyColors.White,
    };
pm.Axes.Add(new LinearAxis(AxisPosition.Bottom, 0) { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, Title = "time",Minimum=0, Maximum=15 });
pm.Axes.Add(new LinearAxis(AxisPosition.Left, 1) { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, Title = "Values", Minimum = 0, Maximum = 10 });

pm.Series.Add(lineSeries1);
plot1.Model = pm;

panel1.Controls.Add(plot1);
Also changing the minimum and maximum values later on does not do anything.
lineSeries1.Points=this.points;
this.pm.Axes[0].Maximum = this.points.Last().X;
this.pm.Axes[0].Minimum = this.points.Last().X-3000;
this.pm.RefreshPlot(true);
Please help.
0
W trakcie analizy

Layered polar plot

zhadziah 10 lat temu zaktualizowano 10 lat temu 2
Hello everyone!
I have a question. I'm investing possibility of using oxyplot for radar PPI display using it's polar plot.

I would like to know is there an option to put a map of scanned area inside the polar plot (inside it's boundaries) and on top of that map I would like to draw scanned targets. Can it be done?
Maybe using background, or tile map annotation?

Regards

Tracker custom precision

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

krafty wrote at 2013-07-23 11:43:

Hi,

I wanted to round off the double precision displayed in the tracker X and Y values .. using some custom rounding values. Is it possible to do with the current tracker?

Thanks

everytimer wrote at 2013-07-23 12:21:

See Tracker Examples
  <oxy:Plot.DefaultTrackerTemplate>
                <ControlTemplate>

                    <oxy:TrackerControl Position="{Binding Position}" BorderThickness="2" BorderBrush="LightSteelBlue" LineStroke="SteelBlue" LineExtents="{Binding PlotModel.PlotArea}">
                        <oxy:TrackerControl.Background>
                            <LinearGradientBrush EndPoint="0,1">
                                <GradientStop Color="#B0C4DE" />
                                <GradientStop Offset="1" Color="#f0ffffff" />
                            </LinearGradientBrush>
                        </oxy:TrackerControl.Background>
                        <oxy:TrackerControl.Content>

                            <UniformGrid  Columns="2" Canvas.Left="{Binding Position.X}" Canvas.Top="{Binding Position.Y}" Margin="6">
                                <TextBlock Text="{Binding Series.Title}" FontWeight="Bold" FontSize="15" Foreground="Black" />
                                <TextBlock Text="{Binding Series.Tag}" Foreground="Black"/>
                                <TextBlock>
                                    <Run Text="X:" FontWeight="Bold" Foreground="Black" />
                                    <Run Text="{Binding DataPoint.X, StringFormat='{}{0:0.000}'}" Foreground="Black"/>
                                </TextBlock>
                                <TextBlock>
                                    <Run Text="Y:" FontWeight="Bold" Foreground="Black" />
                                    <Run Text="{Binding DataPoint.Y, StringFormat='{}{0:0.000}'}" Foreground="Black" />
                                </TextBlock>
                            </UniformGrid>

                        </oxy:TrackerControl.Content>
                    </oxy:TrackerControl>

                </ControlTemplate>
            </oxy:Plot.DefaultTrackerTemplate>
Good luck

krafty wrote at 2013-07-23 13:11:

Hi everytimer..

Thanks for the example. I have seen it but I don't think its dynamically possible to change the precision with it?
StringFormat='{}{0:0.000}'

everytimer wrote at 2013-07-23 13:39:

I think you should create a custom Series derived from LineSeries with the TrackerFormatString property exposed. See MatrixSeries.cs.

Good luck

raphay wrote at 2013-07-23 13:41:

Just put StringFormat='{}{0:0.0}' for only one decimal for example.
If you want more explanation about double format : http://www.csharp-examples.net/string-format-double/

krafty wrote at 2013-07-23 14:04:

Thanks everytimer... That's a good idea, it will work!

krafty wrote at 2013-07-23 14:08:

Thanks raphay.. But my query was more towards the binding aspect.
cheers.

CompositionTarget.Rendering leak?

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

anomistu wrote at 2012-04-19 16:08:

Hi,

I think I've stumbled upon a memory leak when dynamically generating plots. Imagine something like this:

<ItemsControl ItemsSource="{Binding}">
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Orientation="Vertical" />
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <oxy:Plot Model="{Binding}" Height="300"/>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>


Even though the context changes, "old" plots remain hooked and, after profiling, I'm pretty sure the CompositionTarget.Rendering event is the culprit.

I eagerly await your comments on this.

Thank you


objo wrote at 2012-04-19 21:29:

thanks for the notice, I have planned to do some memory profiling, will try to get it done soon.

I have implemented a weak event manager for the rendering event in the helix toolkit, this should be possible to use.


anomistu wrote at 2012-04-20 14:14:

I saw that you've had a similar problem on the helix project, however the weak event manager you've used over there is not available in SL.

Another problem is that in SL the CompositionTarget class is static, not abstract, as in WPF, so it can't be used as an argument to most weak event listeners available out there that use generics when subscribing.

DateTime axis

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

steunissen wrote at 2011-11-17 13:39:

I am trying to get it to work but I don't succeed:

 

I want to display outside temperatures for a complete year with 1 hour interval values. (so I have 8760 value pairs).

for the horizontal axis I use a DateTime axis. But I have trouble setting the right settings for the horizontal axis.

I've set the MajorStep to 0.125 to display the majorgridlines each 3rd hour.

But I don't get the Minor gridlines to display. (settting MinorStep to 0.04166666666)

<TabItem Header="DateTime (XAML)">
            <oxy:Plot Title="DateTime axis (XAML binding)" Margin="20">
                <oxy:Plot.Axes>
                    <oxy:DateTimeAxis Position="Bottom"
                                      StringFormat="MMM-ddd-HH"
                                      MajorGridlineColor="Black"
                                      MajorGridlineStyle="Solid"
                                      MajorGridlineThickness="1"
                                      MajorStep="0.125"
                                     
                                      
                                      MinorGridlineColor="Red"
                                      MinorGridlineStyle="Solid"
                                      MinorGridlineThickness="1"
                                      MinorStep="0.041666666666"
                                      
                                      />
                </oxy:Plot.Axes>
                <oxy:Plot.Series>
                    <oxy:LineSeries ItemsSource="{Binding Data}"
                                    DataFieldX="Date"
                                    DataFieldY="Value"
                                    StrokeThickness="1"
                                    MarkerSize="3"
                                    MarkerType="Plus"
                                    TrackerFormatString="Time: {2:yyyy-MM-dd HH:mm:ss}&#x0a;Value: {4}" />
                </oxy:Plot.Series>
            </oxy:Plot>
        </TabItem>

 

 

 

Any suggestions ?


objo wrote at 2011-11-18 06:19:

I checked in a little change that let you set the MinorStep on the DateTimeAxis.

I keep getting a crash in ListFiller:Fill

Oystein Bjorke 10 lat temu 0
This discussion was imported from CodePlex

willmoore88 wrote at 2013-09-18 16:30:

I keep getting random crashed in the Fill function in ListFiller.cs. I get the Collection was modified; enumeration operation may not execute error on IEnumerable source in the foreach (var sourceItem in staticSource) line.

I have had other similar problems within the rest of the library, where because I update datasets quite often, obviously before the last has been written to screen, the array has been updated before it has finished iterating through it! Normally, casting ToArray() // ToList() has solved this.

objo wrote at 2013-09-20 09:18:

Is this problem solved when you use ToArray/ToList in your application?
I would like to avoid adding this to OxyPlot, as I guess there may be a performance hit for large datasets.

Can we lock the collection's syncroot while updating the plot?

willmoore88 wrote at 2013-09-20 09:29:

It has been solved where I've used it in other places, but obviously can't here.
I'll have a look at syncroot, thanks.

willmoore88 wrote at 2013-10-07 14:02:

The way I seem to have solved this was my using a ConcurrentQueue instead of a List as my ItemsSource. ConcurrentQueue's are thread safe and so have avoided the issue where the ItemsSource was getting updated whilst that function was looping. I think if I had implemented the same thing throughout my application then maybe I wouldn't have needed to do any ToArray's. Hopefully if I have time i'll go back and undo all of that - as you say, large datasets maybe hit and I do have HUGE datasets. Maybe something to look at in your tutorials? ConcurrentQueue's are no harder to implement than lists but are thread safe :-)