Electric Power factor Chart

Oystein Bjorke 10 years ago 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).