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

Time (y) over Date (x) possible?

Martin Rothschink vor 9 Jahren 0
Hi all,

is it possible to create such a plot like this one here:
http://homeserversoftware.com/lo/w78/help/en/3_uptime_tab_7_days.png

If I have to implement that myself, is there a base class I can extend or derive from?

Thanks
Martin

Declaring an instance variable for an OxyPlot graphing object

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

faroskalin wrote at 2013-12-06 16:52:

I am using OxyPlot, a graphing library for C#. What confuses me so far is the type for some of the constructors. A code snippet is below:

Image

This generates this image:

Image

(It's a heat map)


My question is - what is var? For example, when you create a new multidimensional array, you do this:
double[,] doubleArray = new double[columns, rows];
Understandingly, the type for this is a double[,]. Why I need to know this is that I would like to store the heatmap as an instance variable, more specifically, heatMapSeries1.Data as a multi-dimensional array. However, in VS, I am unable to declare var as the type for an instance variable. The only selection I get is this:

Image

Any OxyPlot pros in here could lend me a hand? Thank you.

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

You can only use var within method scope:
http://msdn.microsoft.com/en-us/library/bb383973.aspx
use explicit types for fields and properties.
I prefer to use var where possible, it reduces code duplication.

faroskalin wrote at 2013-12-06 18:59:

Ah I understand now.

Thanks.
0

Determining axis sizing & coordinating plot alignment: proposal

Jonathan Shore vor 10 Jahren 0
I have a series of PlotModels (Views) where I want to align 1 axis.  For example I may have a series of plots aligned vertically with the same X axis, but with different Y axes.

A problem to solve is that the render-width of each of these Y axes may be different (and in fact may change as a given plot is panned).   I can set PlotMargins left to a fixed value, but this may clip the rendering for am axis.  The ActualPlotMargin property will not adjust to the natural sizing if the PlotMargin dimension is override.  Hence, I have a problem in adjusting the margins across panes in that if I adjust I cannot remeasure the natural sizing.

I would like to latch on to an event and interrogate the Y axis of each pane calling:
   axis.Measure(IRenderContext)
on each axis and adjust to the max extent across the set.

As the render context is private to the PlotView, do not have access to call the Measure method, unless the context is carried with an event.   How can I get access to this information?

Proposal
Perhaps it makes sense to have instead of Axis.Measure(rc) something like:  Axis.Update (IRenderContext) and have a public property like "ActualDimensions" on Axis which would be used for both internal axis sizing during the rendering cycle and for use in client applications.

Plot foreground and title styling

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

springy wrote at 2013-01-15 10:05:

Hi,

Great component, managed to meet my requirements within minutes of using it.  However, I can't seem to work out how to style the plot.  Basically I want the title and legend text in white, and the border of the plot white.  I've tried the following properties on the plot but they don't seem to make any difference;

  • TextColor="White"
  • Foreground="White"
  • PlotAreaBorderColor="White"

Any help much appreciated.

Lee.


objo wrote at 2013-01-22 10:32:

I added a new example "ColorBindingDemo" in Examples/WPF/WpfExamples. It seems to work as expected. The inherited property Foreground is not in use.

If you change the colors in a PlotModel, remember to refresh the plot afterwards - this is not handled automatically.

0
Beantwortet

Scatter series points with different color

Xavier Hahn vor 10 Jahren aktualisiert von anonymous vor 10 Jahren 5
I'm trying to make a graph with a few points, with some that should be a different color based on whether they are "outliers" or not. Basically, I display scatter points, and if a property on the list I'm binding the ScatterSeries to is "true", then the color of the point should be red, otherwise it should be black.

I've tried using the LinearColorAxis for this, but no luck yet. Here's the code (WPF) I have now:
<oxy:plot title="Repetitions">
<oxy:plot.axes>
	<oxy:linearcoloraxis key="Outliers" position="Right" minimum="0" maximum="1" highcolor="Red" lowcolor="Black"></oxy:linearcoloraxis>
	<oxy:linearaxis position="Bottom" title="Measurement"></oxy:linearaxis>
	<oxy:plot.series>
	<oxy:scatterseries itemssource="{Binding Item.Repetitions}" coloraxiskey="Outliers" datafieldx="RepetitionNbr" datafieldy="ExcessRayleighRatio" datafieldvalue="IsOutlierValue"></oxy:scatterseries>
	</oxy:plot.series>
</oxy:plot.axes>
</oxy:plot>
The DataFieldValue does seem to be took (if I put a breakpoint in the property, I can see the binding working, the IsOutlierValue is a "double" property that returns 1.0 if I want the point "red", and 0.0 if I want it black. But the points don't change color.

Silverlight Mouse clicking bug

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

Tech_Junkie wrote at 2012-09-27 17:14:

Dear Objo (or others who know the solution)

In my project I use three mousehandlers on the plotmodel that is linked to the plot. Somehow if I click very fast, or move my mouse during the clicking (then it happens quicker) silverlight crashes. I think it has to do with putting annotation lines in the plotmodel, and a minimal example that has this behaviour can be seen at: 

http://pastebin.com/MNezy8wj

In the final project there is more data and more happens in the mousehandlers apart from the adding of the annotations. But this is a minimal example that also shows the crash.

When I do not use my own mousehandlers, there is also a but of lag sometimes when clicking excessively or moving the mouse around during the clicking. Could it have something to do with internal timelag and not being able to call the handlers quick enough?


objo wrote at 2012-09-29 20:40:

thanks for creating the minimal example. I am not sure why your example crashes, but I see you are adding the same annotation instances to the model's Annotations collection multiple times! OxyPlot currently does not check this for you. I did some changes and the following version does not crash on my machine http://pastebin.com/8hb7EzZH


Tech_Junkie wrote at 2012-09-30 12:03:

Thank you for taking a look. This is very similar to what I do in my real project, I also check the axis for its inverse point to get the value to plot on. There I also clear the list of annotations before adding new ones I want to go render, because I also include a text and arrow annotation for the value. For this example I just set a fixed value, to make the code more readable, while it still crashed. 

I think that maybe the forwarding of the event and the GetAxesFromPoint(e.Positionout xaxis, out yaxis); method help the application from not crashing, but i'm not sure. But because I won't be working on this project anymore, I am not in a position to check if this will work or not. I have tipped a colleague who will take this over from me about this thread and hope / guess that he will take a look at it.

Text with a LineAnnotation on the right-hand side

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

Tech_Junkie wrote at 2012-08-13 14:00:

The module is still doing what I want, thank you for all the functionality Objo, but now I'm diving deeper and deeper into the use of the code, and of course I'm finding small boundaries.

After http://oxyplot.codeplex.com/discussions/376175 it is not possible to give the text with a LineAnnotation a TextOrientation. This is great! except that the text is always put on the same side of the line (here it is the left-hand side) and sometimes (for instance when the line is very close to the lower end of the plot) I would like to put the text on the right-hand side of the line because it will not be readable otherwise.

Would it be possible to specify a left / right (and above / under) relative location for the text with a LineAnnotation?


objo wrote at 2012-08-21 13:30:

Agree - this should be added. It would be best if this was automatic, but maybe this is not possible? Also - the text orientation enum could be replaced by a text direction angle?


objo wrote at 2012-08-23 15:56:

Added issue http://oxyplot.codeplex.com/workitem/9987

It is possible to tell if the mouse click is over a marker on a scatter or line series

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

oriches wrote at 2014-05-08 19:29:

I want to know when a user clicks on a data point (marker), is this possible?

objo wrote at 2014-05-10 23:22:

See examples under "Mouse events" in the example browsers! The "MouseDown event and HitTestResult" example should cover your question.

oriches wrote at 2014-05-12 10:58:

Thanks for the info.

About Scatter and Coloraxis

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

CSharpdevs wrote at 2014-05-14 19:06:

Hi,
I want to use scatter series with color axis but an error occurs this process. I investigated some examples and see following code. When i used this code, i recieve the error code "Cannot create an instance of the abstract class or interface". I tired use Linearcoloraxis instead of Coloraxis, the code is working but the colors of data points are same.
Thanks for helps.

No working:
var colorAxis = new ColorAxis{ Position = AxisPosition.Right, Palette = OxyPalettes.Hot(30),Minimum=0,Maximum=10,HighColor=OxyColors.Blue,LowColor=OxyColors.BurlyWood};


Working code:
var model = new PlotModel();
        var colorAxis = new LinearColorAxis{ Position = AxisPosition.Right, Palette = OxyPalettes.Hot(30),Minimum=0,Maximum=10,HighColor=OxyColors.Blue,LowColor=OxyColors.BurlyWood,Key="r"};
        model.Axes.Add(colorAxis);
        var s4 = new ScatterSeries {ColorAxis = colorAxis };
        s4.MarkerType = MarkerType.Circle;
        s4.BinSize = 10;
        s4.Title = "renk";
        s4.MarkerStrokeThickness = 1;
        Random r=new Random();
        s4.Points.Add(new ScatterPoint(3, 5, 10*r.NextDouble(),1));
        s4.Points.Add(new ScatterPoint(5, 5, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(2, 4, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(3, 3, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(3, 2, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(3, 5, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(2, 2, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(1, 4, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(4, 3, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(0, 0, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
        s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
        s4.XAxisKey = "X axis";
        s4.YAxisKey = "Y Axis";
        model.Series.Add(s4);
        plot1.Model = model;

LineAnnotation on multy Axes

Oystein Bjorke vor 10 Jahren 0
This discussion was imported from CodePlex

Ivan_kol wrote at 2013-07-17 19:18:

There are many elements of the Axis, we must somehow specify the element LineAnnotation what used to work the same way as is done in LineSeries:
<oxy:LineSeries ItemsSource="{Binding Items}" MarkerType="Circle" Color="DarkBlue" YAxisKey="Length" XAxisKey="Volume" />

How to do it for LineAnnotation?

raphay wrote at 2013-07-18 11:21:

You should use a Plotmodel from the OxyPlot Core library. Indeed some element in the WPF library are not finished yet (Annotation don't have axis key in this library, but they have in the core library).
So build your chart on a PlotModel in your code, then set the chart model property to this Plotmodel.

I hope this will help