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

Can't run in Embedded Resource [WPF]

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

co3moz wrote at 2014-02-06 14:34:

Hello guys,

I want to run OxyPlot in EmbeddedResource. I can run other Libraries in EmbeddedResource but OxyPlot gives an error.

'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' ... System cant find that file.

OxyPlot runs normal if i put OxyPlot.dll in folder. Other dlls like HtmlAgilityPack can run in EmbeddedResource ( With some magic (: ). Why OxyPlot needs "OxyPlot.dll" in folder?? So what i should do?
Under review

TrackerFormatString question

Oystein Bjorke 10 years ago updated by anonymous 10 years ago 3
This discussion was imported from CodePlex

seveland12 wrote at 2012-06-04 19:11:

In the documentation page

http://oxyplot.codeplex.com/wikipage?title=Custom%20trackers&referringTitle=Documentation

it states that you can define what the tracker displays by modifying the TrackerFormatString property of the series. What format is this property expecting? In particular, if I want my tracker to show the following:

 

X Axis Title: 0.###

Y Axis Title: 0.###

 

(where 0.### is meant to be the appropriate value to 3 decimal places), what do I have to set TrackerFormatString to? I'm using LineSeries and ScatterSeries, if that makes a difference.

 

Thanks,

 

Steve


objo wrote at 2012-06-04 22:09:

Sorry the wiki documentation is not finished. 

The tracker format string has some variations for different series (should be documented... and maybe improved?), but it should at least support the following arguments

{0} the title of the series
{1} the title of the x-axis
{2} the x-value
{3} the title of the y-axis
{4} the y-value

For ScatterSeries you also have

{5} the title of the value-axis
{6} the value of the scatter point

This means that in your case you should be able to use

X Axis Title: {2:0.###}
Y Axis Title: {4:0.###}

The format string can also contain names of properties of the items (requires use of the ItemsSource property):

{X:0.###}, {Y:0.###}, {Value:0.###}

where X, Y and Value are properties of your items.


_Noctis_ wrote at 2013-10-21 10:20:

Just in case it helps anyone, and expanding on the above:

If you have a class like this:
class ExercisePoint : IDataPoint
    {
        public double X { get; set; }
        public double Y { get; set; }
        public int Lvl { get; set; }
        public DateTime DateTime { get; set; }
        public string Exercise { get; set; }
    }
You could then create a line series with a custom Tracker that look like this:
var line_series_array = new LineSeries()
                {
                    ... other propreties initialization here ...

                    TrackerFormatString = "{DateTime:dd.MM.yy}"+ Environment.NewLine +"{Exercise}, lvl {Lvl}:{Y}"
                };
This will give you in this case, the date in the given format on one line, and on the second, the exercise, level, and Y value.

Easy peasy once you figure it out ... :)


(Just wondering, any chance of being able to format the text in there? )

oloopy wrote at 2014-04-11 11:19:

Thanks for the post.

An additional tip here. The default setting is like below,
var lineSeries = new LineSeries
{
    TrackerFormatString = "{0} " + Environment.NewLine + "{1}: {2} " + Environment.NewLine + "{3}: {4} ",
}
You can modify it based on that. Also note that the {0} would be used in Legend Title.

Archer25 wrote at 2014-04-30 07:55:

Hello i need help
Ihave a scatterSeries. And i need to for every point's have unique string lines, and this lines must show at the tracker.
How i can do that???
Image

Avoid the DateTimeAxis.ToDouble() result in the tooltip

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

maxambrogi wrote at 2013-04-28 00:59:

Hi, using financial series (as Y values) and date time (as X values) I need to use the DateTimeAxis.ToDouble to convert the date time value in the HighLowItem costructor.

This works fine but the tooltip on the chart show the result of the DateTimeAxis.ToDouble method.

There's a way in order to show the date in tooltip using financial series?

Best regards

MaxAmbrogi

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

this sounds like a bug in the HighLowSeries.GetNearestPoint method. Added to https://oxyplot.codeplex.com/workitem/10044
It is possible the code should be refactored to let the axes do the formatting of the x and y values!

maxambrogi wrote at 2013-04-29 18:27:

objo wrote:
this sounds like a bug in the HighLowSeries.GetNearestPoint method. Added to https://oxyplot.codeplex.com/workitem/10044
It is possible the code should be refactored to let the axes do the formatting of the x and y values!
Seeing the source code thru browser, probably two actions are required:
  1. new constructor and properties in HighLowItem.cs named xAsStringForTooltip (the date as desired string)
  2. refactor the HighLowSeries.GetNearestPoint method in order to manage the presence the above xAsStringForTooltip property
    I'm right and can I support you?
    Best regards
    MaxAmbrogi

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

I have checked in a change that converts the x values to DateTime values before formatting the text of the tooltip. Use the TrackerFormatString in the series to control the format of the date (see examples). My comment about letting the axes do the formatting was not a good idea - the formatting of the dates on the axes may be different.

maxambrogi wrote at 2013-05-29 15:27:

Perfect Objo, many thanks for this!
Best regards
MaxAmbrogi

How to disable or modify the tooltip on a graph

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

laranto wrote at 2013-07-07 17:56:

Hi everybody!!

Please help me!!

You know that when a graph is displayed a fantastic tooltip come in your help to display the coordinates of the mouse selected point.

But I've to display two graphs on the same diagram which are properly scaled so that the max Y value of both the graphs are the same.

It follows that the scaled Y obtained from the tooltip are not representing the originals but the scaled.

So I need to interfere with the mechanism of the tooltip to modify the displayed values or, if it is not possible, to disable the tooltip from one of the graph.

To display the graph I use a PlotModel object to which property PlotModel.Series I next add a LineSeries which represent the graph to display.

Can anyone gime me some feedback?

Thank you very much

everytimer wrote at 2013-07-07 19:50:

Create properties (X', Y') with INotifyPropertyChanged interface implemented that represents the X and Y transformed coordinates. Then add an event to the desired LineSeries (as shown in the examples MouseEvents):
                yourLineSeries.MouseDown += (s, e) =>
                       {
                           if ((e.ChangedButton != OxyMouseButton.Left))
                           {
                               return;
                           }

                      //Here catch the screenpoint
                      //Transform to coordinates of your LineSeries
                      //Apply the scaling X'=a*X, Y'=b*Y
                           e.Handled = true;
                       }; 
The last step is to bind via XAML that properties to the tracker. See the custom tracker examples.

Good luck

laranto wrote at 2013-07-08 13:00:

Thank you very much!!!

I've tried to implement your solution without reaching the goal to obtain a tooltip with a scaled versions of the point coordinates.

I've to give a result as soon as possible.

So I ask you: please is there a fast way to disable the tooltip for a certain LineSeries?

Thank you very much!! :D

raphay wrote at 2013-07-08 16:58:

I think you only need to handle the event
yourLineSeries.MouseDown += (s, e) =>
                       {
                           if ((e.ChangedButton != OxyMouseButton.Left))
                           {
                               return;
                           }
                           e.Handled = true;
                       }; 

laranto wrote at 2013-07-08 17:19:

It's true!!!! Thank you very much raphay :D

Define Axis for annotation in WPF

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

raphay wrote at 2013-04-09 11:11:

Hello,

I have different Y-axis in my WPF application, and i would like to know if i can associate my annotations with one of thoose axis, like it is possible for series with the "YAxisKey" property.

Thanks.

Drawing simple shapes

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

amity2001 wrote at 2012-10-03 11:01:

Hello world,

Is there any way to draw simple shapes like circle, ellipse, square, rectangle, etc. on Oxyplot,

without calculating data points for series.

Like in C# there are few direct methods to draw these shapes, is it possible in Oxyplot by directly giving appropriate parameters like radius, center of circle, etc.

Thanks in advance.


objo wrote at 2012-10-03 19:11:

Use 'annotations' to draw content that should not be listed in the 'legend box'. There are implementations for rectangles and lines, but not ellipses. You could derive an "EllipsisAnnotation" in the same way as LineAnnotation - calculate the points and call DrawClippedLine. IRenderContext does not support clipping of ellipses. I did not include clipping in IRenderContext to make it easier to port to different platforms...

Under review

Keep LineSerie Colors

Oystein Bjorke 10 years ago updated by Kaviraj Muruganathan 9 years ago 5
This discussion was imported from CodePlex

oloopy wrote at 2013-04-27 02:30:

Currently I am using OxyPlot to plot vehicle trajectory data. The total number of lines would be around 2000. OxyPlot does a good job to render these lines efficiently and give them a different color automatically.

But I noticed that colors of lines would be changed if I remove one of lines. And it seems like the color would be rearranged by default color order, which is from green, khaki, red...

For example, I plot three vehicle trajectories below.

Image
(https://www.dropbox.com/s/xx2wygeoeg8sg4p/Screenshot_4_26_13_8_10_PM.png)

ID 2270 is in green. ID 2276 is in khaki. ID 2281 is in red. And the order I plot them is start from 2270, then 2276, finally 2281.

Image
(https://www.dropbox.com/s/pw6ptb0a6w1cadp/Screenshot_4_26_13_8_13_PM.png)

Now I remove ID 2276. Then ID 2281's color changed to be khaki from red.

I would like to know if there is a way to keep the line color as it will help user focus on certain line they are working on.

Here lists my code. It's quite simple.

var lineSerie = new LineSeries();

data.ToList().ForEach(d =>lineSerie.Points.Add(new DataPoint(Convert.ToDouble(d.X), Convert.ToDouble(d.Y))));

plotModel.Series.Add(lineSerie);

viewModel.plotModel.RefreshPlot(true);

:)
Thank you guys!

objo wrote at 2013-04-29 13:28:

I think you should keep your own list of colours, and set the colour for each series manually!
I see that OxyPlot could assign the automatic colour only once, but this requires some changes to the code. Create an issue if you think this is an important feature to add!

objo wrote at 2013-04-29 13:30:

btw, what kind of vehicles are you plotting trajectories for? I am curious :)

Where is IDataPoint in the latest version of Oxyplot?

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

AvanDiepen wrote at 2014-05-07 11:53:

Where is IDataPoint in the latest version of Oxyplot?
When I install the latest version of Oxyplot (OxyPlot-2014.1.297.1) I'm seeing the error:
Error 4 The type or namespace name 'IDataPoint' could not be found...
How can I solve this error?

Code:
private List<IDataPoint> listScheefstand { get; set; }

FishySwede wrote at 2014-05-08 08:48:

I had a similar issue. I believe the IDataPoint interface was removed to address performance issues. Switching to the DataPoint class should solve the issue.

Try:
private List<DataPoint> listScheefstand { get; set; }
instead.

If you're using a ScatterSeries you should probably use ScatterPoint instead.


Note that I'm just a user of OxyPlot, not a contributor. Perhaps a contributor can verify or correct this.

AvanDiepen wrote at 2014-05-08 08:52:

Thanks a lot FishySwede. That solved the problem, now I can use the latest version of Oxyplot.dll

objo wrote at 2014-05-08 08:56:

@FishySwede: your answer is correct! Thanks for contributing in the discussions forum!

FishySwede wrote at 2014-05-08 10:20:

Glad I could help :)

Disable Tracker

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

jpnavarini wrote at 2012-07-03 14:01:

Hello everyone,

I would like to disable the tracker on my plot. Is it possible?

I am using a bar graph, and the default tracker contains the label of each box followed by its value. Another possible option for me is to change the tracker message to have only the box value, without its name. How can it be done?

Thank you.


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

I don't think it is possible to hide the tracker. This is related to issue http://oxyplot.codeplex.com/workitem/9625 - it should be possible to change the mouse gesture to activate the tracker - and to disable it. I have not implemented this yet, but hope to do it later this year.

To change the tracker text for the BarSeries/ColumnSeries, try to set TrackerFormatString = "{2}"

I will add more information about the tracker format strings at http://oxyplot.codeplex.com/wikipage?title=Custom%20trackers


taschmidt wrote at 2012-11-01 04:09:

FYI, I got around this (what I would consider a limitation) by putting a transparent Border (or Rectangle would also work) over the chart to prevent mouse events from getting through.


fabsenet wrote at 2013-07-19 14:30:

I solved the issue using another workaround:

<Metro:Plot IsHitTestVisible="False" ... />

kittof wrote at 2013-11-22 10:32:

To disable the tracker, you can set the DefaultTrackerTemplate to null:
<oxyPlot:Plot Model="{Binding PlotModel}" DefaultTrackerTemplate="{x:Null}" />

wpf RenderContext discussion

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

ProCodeMyth wrote at 2013-05-29 08:08:

we can descripte 2d shape use geometry, drawing ,shape in wpf ,but three object is very deferent,only shape can display it on screen. geometry only descripe 2d graphic object which only store graphic data. geometry don't render by itslef ,so i think oxyplot don't need GeometryRenderContext , we can add geometry object to wpf Path classe Data propety. then we can see what we want . Drawingcontext is most closest to graphic of gdi, but drawingcontext
is abstract classe, to render any shape ,we have to use drawingcontext in visual ,once we draw what we want, drawingcontext must close. so DrawingRenderContext in oxyplot have means(value) only when we put DrawingRenderContext in visual and add visual to visual tree . if we want development in DrawingRenderContext envimoment , we mayehave to resturture entire oxyplot.wpf.

objo wrote at 2013-06-08 10:49:

DrawingRenderContext and GeometryRenderContext are not included in the build, these classes are just kept for reference.
There was not much performance improvement with DrawingRenderContext or GeometryRenderContext, and I think there were also some problems related to aliasing / anti-aliasing.

Another approach would be to create a render context based on DirectX (e.g. using SharpDX) or WriteableBitmap(using WriteableBitmapEx?).