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

Annotation Label Bug

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

pocketbboy wrote at 2011-12-08 15:27:
Hy. I 'm using annotations and the problem is that the labels are geting out from the plot area . There is a solution to that?
 

objo wrote at 2011-12-09 18:55:
that must be a bug. I add it to the issue tracker, will correct it later when I get time!

Electric Power factor Chart

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

chirstianbobsin wrote at 2012-05-14 23:29:

Hi Objo, 

I have a strange question.

Can I plot a chart that 4th quadrant ranges from -0.001 to 1 and the 1st quadrant ranges from 0.001 to 1? to produce a chart like this sketch with oxyplot?

We are doing an electrical engineering chart of power factor measurement. And the chart must be Like this.

    ^
 0.0|
    |
    |
 0.5|
    |
    |
 1.0|------------------------------------------->
    |
    |
-0.5|
    |
    |
 0.0|



objo wrote at 2012-05-15 06:07:

That's a special case not supported by the LinearAxis.

You have to make a custom axis yourself to do this. Look at the LinearAxis implementation, maybe you can just override some of the methods of the LinearAxis class. Let me know if I should make more methods virtual.


chirstianbobsin wrote at 2012-05-15 13:07:

Ok I'll look for this. I asked only to know if possible. I think only in July or August we'll do something like this.


bsguedes wrote at 2012-11-14 10:24:

Just for information, I achieved to do this graph by extending LinearAxis and overriding method 'virtual string FormatValue (double x)'. By doing this way the axis will show the values you want by modifying the value passed to base.FormatValue(x). It requires recalculating some values, though (for instance, I've chosen to convert values in the range shown in the desired chart to -1 to 1).

It is also necessary to change values shown by the tracker, for this I created PFSeries which extends LineSeries, and whose GetNearestPoint method is overridden in order to return a PFTracker (which extends TrackerHitResult).


objo wrote at 2012-11-14 18:27:

One more idea... try to create two vertical axes:
The first: Minimum=0.001, Maximum=1, StartPosition=1.0, EndPosition=0.5
The second: Minimum=-0.0001, Maximum=1, StartPosition=0, EndPosition=0.5

Then add one series for the data in the 4th quadrant, and one series for the data in the 1st quadrant.

(I have not tested this...)


bsguedes wrote at 2012-11-19 17:45:

I've tried this but with two axes zoom is no longer synchronized between quadrants, and you would need to add two series actually, instead of one (one series for the upper chart and another for the lower one).

Get actual MinorStep (or any grid-related values)

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

tboloo wrote at 2013-05-04 20:25:

Dear oxyplotters,
I am trying to create plot containing both Carthesian and Polar grid. For the first one I use regular Major- nad MinorGridLines, whereas for the second one I intended to use EllipseAnnotations. Now everyting would be fine, if only I could get the actual Major- or MinorStep, the problem is that both are either zero or NaN. Any hints on what can I do?
Regards,
Bolek

objo wrote at 2013-05-06 10:33:

Maybe you are querying the properties too early. The ActualMajorStep/ActualMinorStep properties are set when the plot is being updated/redrawn. The values of these properties depends on the width/height of the plot.

Highlight particular point

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

amity2001 wrote at 2012-10-18 08:29:

Hello World!

I am looking for highlighting peaks in the series with different color. I have set of points in which some points are peaks.

With line series I plotted the set of points without any marker symbol. Now I want to highlight peak points only.

Is it possible to highlight any particular point on the series with different color or shape?

Thanks in advance.


objo wrote at 2012-10-18 09:02:

In the LineSeries all markers have the same size and color.

Could you use a ScatterSeries for the markers? Then you could set the color or size for each peak marker. I have not tried this myself...


amity2001 wrote at 2012-10-18 09:26:

In the LineSeries all markers have the same size and color.

Hi objo,

Thanks for reply.

Line series is OK for me to plot graph.

If I set marker to line series the control shows ALL points in the form of markers while I want to show only SOME points as markers (Peaks in series)

Would you please explain how it can be achieve?

Thanks in advance.


objo wrote at 2012-10-18 10:19:

Try a ScatterSeries or an extra LineSeries (with line thickness = 0) for the peak points.

How can I draw a line series against the Y axis?

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

willmoore88 wrote at 2013-07-18 16:05:

I need to plot a graph like this one, against the Y axis.

http://www.intechopen.com/source/html/16221/media/image7.png

Any ideas?

everytimer wrote at 2013-07-18 17:41:

What's the problem? Just provide the right List<DataPoint> and you're done. If you already have the data in the "normal" format run a loop like this:
foreach (DataPoint p in myList1)
{
      myList2.Add(new DataPoint(p.Y, p.X);
}
Good luck

Labels overlapping each other in column chart if the values are too low

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

WiseDeveloper wrote at 2014-01-15 19:08:

In a stacked column chart, the labels overlap each other if the values are too low.
Image

Please help with solution or workaround.

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

I think this should be implemented in the ColumnSeries or BarSeriesBase class.
If the height of the rectangle is less than the height of the label text, the labels could be hidden.
Moving the labels so they don´t overlap is probably much harder.
I created an issue: https://oxyplot.codeplex.com/workitem/10123

WiseDeveloper wrote at 2014-01-30 06:57:

Thank you, objo.

Save Plot to image

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

tboloo wrote at 2013-10-09 15:16:

Hi everyone,
I am trying to create a report which is supposed to include plot graphics and data (from other views in the application). Now I have checked the documentation and forums, and it seems that there is no ToImage() method in OxyPlot.WPF, neither there are SaveBitmap, ToBitmap methods mentioned in elswwhere, only ToCode and ToSVG which are of no use in my scenario. So my question is is there a simple, or relatively simple, way to get the plot as image?
Regards,
Bolek.

willmoore88 wrote at 2013-10-10 12:36:

You can simply do a CTRL+C to copy the plot to the clipboard? Might point you in the right direction.

tboloo wrote at 2013-10-10 13:39:

CTRL+C works, but what I need is to call it from my ViewModel, but I can not call
System.Windows.Input.ApplicationCommands.Copy.Execute(null, PlotModel);  
as PlotModel is not of IInputElement type.

Gimly wrote at 2013-10-11 17:04:

Why don't you use the PngExporter?
Usage example:
PngExporter.Export(this.PlotModel, stream, 800, 600);
That creates the image in the form of a PNG in the stream (for example a filestream or a memory stream.

You can also use
BitmapSource bitmap = PngExporter.ExportToBitmap(this.PlotModel, width, height, backgroundColor);
This create a BitmapSource that can easily be added to the clipboard or used any way you want.

Hope this helps.

tboloo wrote at 2013-10-14 12:20:

Thanks Gimly, tthat solves my issues.
Regards,
Bolek.

Restore / Save zoom levels

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

krafty wrote at 2013-03-27 07:33:

Morning all,

I have a requirement to save certain zoom levels on a graph which the user can undo...

Can we save the current zoom level for all the axes and then restore it (explicitly set them)?

Thanks.

mohitvashistha wrote at 2013-04-29 17:42:

Me too trying to achieve the same. Did you had any luck??

objo wrote at 2013-04-29 18:11:

Try to subscribe to the AxisChanged event on the axes (note this event is also raised when panning/resetting the axes), save the ActualMaximum and ActualMinimum properties. Call the Zoom(x0,x1) method to restore the view. It is possible zooming with the mouse wheel or zooming several axes may be difficult to revert (multiple events), maybe you can use a stopwatch to 'group' these events?

mohitvashistha wrote at 2013-04-29 20:17:

I have extended the control to store the zoom state on a stack and on all maniuplators started event I have pushed the zoom state. When I want to move to previous state I just pop a state and call the Zoom(axis,x0,x1) to set the previous state for the axis.

All my charts have two axis, for multiple axis one can store the axis and its current max and min.
0
На рассмотрении

How to print a plot in WPF

Mark Abermoske 9 лет назад обновлен Oystein Bjorke 9 лет назад 1
Does anyone have experience printing Plots? I have a printing library that I am using, and it can take a bitmap or image to add to the page, and right now I am using this code:


Bitmap bitmap;
using (var outStream = new MemoryStream())
{
var pngExp = new PngExporter();
var source = pngExp.ExportToBitmap(model);
var enc = new PngBitmapEncoder();
enc.Frames.Add(BitmapFrame.Create(source));
enc.Save(outStream);
bitmap = new Bitmap(outStream);
}

This works, but the bitmap is very blurry. Is there a better way to do this.

Thanks!

Overlapping labels.

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

Nihau wrote at 2014-01-27 05:30:

Hi everyone who is reading this thread.

I was surfing "oxyplot example browser" and saw this:
Image
My question is how do i remove overlapping of labels? Of course i can thin out every 2,3,4.. etc label, but this solution requires proper event. How to deal with it?

objo wrote at 2014-01-27 15:18:

I think this should be implemented in the CategoryAxis. If a category is too narrow, it should not show the label for each item.
I added
https://oxyplot.codeplex.com/workitem/10121

You can workaround by subscribing to AxisChanged events and finding the category width yourself, but I think it is easier to fix this in the CategoryAxis!

Nihau wrote at 2014-01-28 09:50:

Oh, wow!

Thank you for adding issue, can't wait this to be fixed.

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