Using line series as annotation

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

Gimly wrote at 2013-09-19 12:19:


I would like to use annotations in the same way as the scatter example with least square fit, but with a polynomial fit.

I thought that I could use the "Equation" of the LineAnnotation, but the equation is too complex to define as I'm doing a graph that does a 2D representation of a 3D graph.

Is there a way to define the LineAnnotation with points, as we would do for the LineSeries?
Is there another way I could do that?

A "hack" that I tought would be to simply create LineSeries for my fit, but then when I click on the line I get the value of the fit, which I don't want. Can we remove the popup that displays when we click on the line?

objo wrote at 2013-09-20 09:05:

The LineAnnotation is intended for straight lines.
I think a PolylineAnnotation should be created for polylines, and the implementation should be much easier than the LineAnnotation :)

Gimly wrote at 2013-09-20 11:19:

You say that the line annotation is intended for straight lines, but I can easily do this:
LineAnnotation lineAnnotation = new LineAnnotation()
       Equation = (double x) => { return Math.Sin(x); },
       Type = LineAnnotationType.EquationY
And it gives me a nice sinusoid, doesn't seem to be any issue with displaying curves and the like.

I'll give a try at creating a PolylineAnnotation, will give me an excuse to dive into the code as I will probably have reason to do some changes for my needs in the future :).

Otherwise, is there a way to remove the popup that gives the value when we click for some specific series?

Thanks for your answer!

objo wrote at 2013-09-20 11:27:

Right, I forgot that :)
I think that feature should be removed from the LineAnnotation, and suggest to create a subclass FunctionAnnotation!