Examples and Documentation

Oystein Bjorke 6 year бұрын 0
This discussion was imported from CodePlex

isaks wrote at 2011-11-24 09:20:

I just started to use Oxyplot for a prototype I'm developing and I must say I find it quite hard to get up and running if you don't know anything about the library first.

First of all, I do understand that this is an open source project and that you may not have time or energy to work on all crazy stuff users ask of you, but I'd like to at least present my initial impressions as a new user of the library and then you can decide what to do with the information :)

Basically, what I'm lacking is a quick start/introduction to oxyplot with complete samples. I did jump through many of the pages on this wiki but from what I can tell, there's no real "Here's how you get started with oxyplot, drawing a simple line chart and populate it with data" kind of document.

I did find solutions to specific issues but I'm lacking the overall picture. 

The example browser is great, but without easy access to source code they feel more like marketing material than an assistance to consumers of the library. It would be nice if I could go from viewing a sample to see the actual XAML (and perhaps C# code) needed to create that particular chart example. (I do understand now that the source is in svn and I've just downloaded it and will have a look at it). 

Here are my suggestions on how this could be improved, feel free to completely ignore them :-)

  • Include a quick start documentation page on this page with a complete example for writing a chart
  • Have the example browser show the source code for each example. For example, Syncfusion has a tab control with the live running chart on one tab and the XAML on another, that would be an awesome addition.
  • Make a source release of the examples available as a standalone download (just to lower the barrier to get started, to not have to bother with svn/tfs/git etc.)

Anyway, thanks for a nice library. 

anomistu wrote at 2011-11-24 09:47:

I'm sorry but you seem not to have browsed the site thoroughly at all.

You've got Ctrl+Alt+C to copy code that generated the chart to the clipboard (instructions on the Home page). Try it in the example browser.

Also you can download the zip with the source code of the latest version from the Source Code page ("Download" link on the right side of the page). I can't think of an easier way to access source code really.

objo wrote at 2011-11-24 19:03:

Hi Isaks! thanks for the feedback, no problem with 'straight talk' :) 

I am planning to improve the documentation, and add a introduction for beginners, but don't have time for this myself until next year (if anyone would like to contribute here, let me know!).  

I would also like to increase the unit test coverage, that's getting more and more important now when the project gets patches from different people.

Anomistu has a good point - use Ctrl+Alt+C to see the code that generates the plot model for any plot made by this library (this is also a good way to report bugs!).  We can easily show this c# code in all the example browsers (both WPF, SL and WinForms) - will do that later! 

isaks wrote at 2011-11-28 11:36:

I didn't know about the Ctrl+Alt+C shortcut. That's very useful. Thanks! (having it in visible directly the example browser would make it even more awesome though, as you plan objo)

Regarding the source code download, yes that's what I eventually did and it works fine. I'm starting to feel more comfortable with the API now that I've managed to create a few charts and have the code in front of me.

Also, it's good to hear that documentation improvements is on the roadmap.

truyenle wrote at 2011-12-19 22:08:

Hi anomistu,

Totaly newbie to this, so I got silly question as: on the example page http://www.objo.net/oxyplot/ExampleBrowser/

click on an item on the left, then Ctrl+Alt+C => the code will be copied to clipboard so that you can past wherever you want?

I try this and nothing is copied,

I then try click on an item on the left, click the mouse on the right ploting section, and then Ctrl+Alt+C => Still nothing is copied.

So what did I do wrong, please help to share.

Again, sorry if it is a silly question.


objo wrote at 2011-12-19 22:33:

Focus must be on the plot control (that should be ok when you click on the plot section). When you click Ctrl+Alt+C, Silverlight should ask for access to the clipboard. Do you get a messagebox "Clipboard access is not allowed"? Then you need to open Silverlihgt configuration and remove "Clipboard - deny" from Permissions. If you don't get the message boxes, something else must be wrong - have you tried different examples?

truyenle wrote at 2011-12-19 23:33:


I have tried many example in that, and seem that I don't have the message like you mentioned.

objo wrote at 2011-12-21 21:57:

Can you check if there are exceptions thrown when generating the code?

I am not able to reproduce this, it works ok on the computers I have tested on.

ysrinu21 wrote at 2014-01-02 04:38:

For a WPF application,

1) should I import all the following 3 references:
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.Wpf;
If I do, then for the following code:
var dateTimeAxis1 = new DateTimeAxis();
var linearAxis1 = new LinearAxis();
I get errors:
'DateTimeAxis' is an ambiguous reference between 'OxyPlot.Axes.DateTimeAxis' and 'OxyPlot.Wpf.DateTimeAxis'
'LinearAxis' is an ambiguous reference between 'OxyPlot.Axes.LinearAxis' and 'OxyPlot.Wpf.LinearAxis'

Can the example code use fully qualified path to avoid ambiguity?

For WPF Axis objects, should I use OxyPlot.Axes. or OxyPlot.Wpf. ?

2) for the code:
var lineSeries1 = new LineSeries();
lineSeries1.MarkerFill = OxyColor.FromArgb(255, 78, 154, 6);
I get error:
Cannot implicitly convert type 'OxyPlot.OxyColor' to 'System.Windows.Media.Color'

How to use OxyColorConverter in this case?

3) For the code:
OxyPlot.Series.LineSeries opLS = new OxyPlot.Series.LineSeries();
opLS.Points.Add(new DataPoint(41363, 0));

OxyPlot.Wpf.LineSeries opWpfLS = new OxyPlot.Wpf.LineSeries();
Method 'Points' is available for OxyPlot.Series.LineSeries and not for OxyPlot.Wpf.LineSeries

-srinivas y.

objo wrote at 2014-01-07 21:57:

1) If you add the axis to a Plot control, you should use the OxyPlot.Wpf.DateTimeAxis. If you add it to a PlotModel, you should use the OxyPlot.Axes.DateTimeAxis
2) If you are using an OxyPlot.Wpf.LineSeries you should use the WPF datatypes: Color.FromArgb(255,78,154,6)
3) The WPF version can only use data binding - set the ItemsSource , I think this should work:
var points = new List<DataPoint>();
points.Add(new DataPoint(41363, 0));
opWpfLS.ItemsSource = points;