Markers, BarSeries and Annotations

Mar 9, 2012 at 2:26 AM
Edited Mar 9, 2012 at 10:23 AM

Hi Objo,


Have been looking around at the source code and your project looks very interesting.

There are a few things I would like to add to the code base:


- Add the possibility to associate a marker with a DataPoint. Currently the marker is set per Series. I would like to make each DataPoint have different markers within a series. I have had a look at the code and this should not be too difficult. I am only interested in changing the LineSeries at this stage. However I am wondering which approach would you prefer:

  • Create a new type that implementes IDataPoint 
  • Inherit from DataPoint?
  • Extend DataPoint (Add a new public Marker property?)

- Create an annotation that will repeat at a set interval. (i.e. gray out Weekends, when dealing with datetime axes. The annotation would have a concept of "width", as weill as number of "repeats").Should I be using the annotations for this? (i.e. using a rectangle with a gray background, for weekends), or should there be another renderer to deal with a hybrid background-annotation type?


- I had a look at the BarSeries, and was wondering if you had any objections to splitting the class into BarSeries and a Column Series class? (BarSeries would be horizontal and ColumnSeries would be Vertical.)

- I would also like to make changes to the BarSeries so that the Bars could start at different values other than zero. Each bar would would be represented by a start and end value. If no start value is supplied then the baseValue will be used by default.

Thanks

Mar 9, 2012 at 8:57 AM

#1: Shouldn't this be on the ScatterSeries? Then a MarkerType property can be added to the ScatterPoint class

#2: Yes, I think annotations can be used for this. Also see http://oxyplot.codeplex.com/discussions/347917

#3: I have considered this, but found it was possible to support both bars and columns in the same class. Can check again if splitting the class will make it simpler.

#4: See http://oxyplot.codeplex.com/discussions/347779 - I think both the tornado series and the bars with start/end values could be custom series. The logic of the BarSeries is already quite complex - supporting stacked bars, negative values, vertical and horizontal bars, and base values different from zero). Also see the HighLowSeries and CandlestickSeries already existing in the library

Mar 9, 2012 at 10:55 AM

#1: Good point. I can use a combination of LineSeries with ScatterSeries to achieve what I want. Thanks for the hint.

#2: OK great. Should be able to easily create a "Region" type based on the PolygonAnnotation type.

#3, #4: The BarSeries is quite complex, that is why I was thinking of splitting it up. The BarSeries and ColumnSeries could both inherit from a base class. The CandleStickSeries looks very similar to what I would like to achieve, except that it needs to be horizontal. I am looking at making a basic Gantt plotModel.

Mar 12, 2012 at 6:28 AM

#3: I splitted BarSeries to BarSeries and ColumnSeries. There is still some refactoring left to do, there is some duplicate code in these classes.

#4: I added a "IntervalBarSeries" that contains items with "start" and "end" value, I think this can be used to create a Gantt chart (have not tested with the DateTimeAxis yet). See the new example in the ExampleLibrary/ExampleBrowser.

Mar 12, 2012 at 7:29 AM

Just pulled down the latest revision.

Looks really good. 

#4. I will try and spend some time over the next few days playing with this.

Noticed that you replaced ISeries and a lot of interfaces with base classes. Wondering what the reasoning is behind that? 

Also noticed the new PlotElement type. Making it serializable and the base to all visual plot elements should allow us to serialise a complete plotmodel and re-create it from a stream. Is that the idea you had behind this?

I wouldn't mind helping out with some documentation, not sure how to go about it.

Mar 12, 2012 at 9:45 PM

See http://msdn.microsoft.com/en-us/library/scsyfw1d(v=vs.71).aspx

I think abstract base classes should be used for the axes, series and annotations. It should be safer for refactoring and versioning, and make the API a bit more restrictive.

I want to add some common functionality to Axes, Series and Annotations in the PlotElement class. Making it [Serializable] was a requirement for the WindowsForms component to work, but it would also be interesting to make the PlotModel serializable as you suggest. Will try that later.

Great if you or anyone else out there would help with some documentation. Send you contributions on my contact form, and I will add it to the wiki. If I am satisfied with the contributions, I can consider changing your role to "Editor".