oxyplot / oxyplot-xamarin

OxyPlot for Xamarin.Mac and Xamarin.Forms
MIT License
64 stars 59 forks source link

Negative values are not potting #111

Open SwathiAdari27 opened 4 years ago

SwathiAdari27 commented 4 years ago

I have negative linear series(y-axis) which is rendered on graph., even though I have negative values those are not plotting on negative y-axis.

are they any ways to plot negative values on negative (y-axis) ?

VisualMelon commented 4 years ago

Could you elaborate on your scenario? I don't understand what you mean by a negative axis. If you can provide code or a visual mock-up, that would be most helpful.

Note that each series only plots on 1 pair of X/Y axes (you can't have separate axes for positive and negative Y values: you would need a separate series).

SwathiAdari27 commented 4 years ago

on y-axis I have both negative and positive numbers (e.g y-axis range is -10 to +10)., even though i have datapoints at negative y-axis its not potting on graph

image

the above is graph with negative and positive values on y-axis., the positive values are potting at y-axis but negative values are not plotting.

VisualMelon commented 4 years ago

Can you provide your code/some reproducing example? It doesn't look like a filtering/multiple-axis/rendering issue (unless there are NaN values in the points?)

Could you also let us know which platform and version you are using (e.g. OxyPlot.WindowsForms v2.0.0)

SwathiAdari27 commented 4 years ago

model.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Minimum = min, Maximum = max, AbsoluteMinimum = absMin, AbsoluteMaximum = absMax, MajorStep = step, MajorGridlineStyle = LineStyle.Solid, MinorTickSize = 0, MajorTickSize = 0, TextColor = OxyColor.FromRgb(255, 255, 255), FontSize = 14, IsPanEnabled = false, IsZoomEnabled = false, StartPosition = 0.1, EndPosition = 0.90, }); the above is y-axis

foreach (Record record in GraphData) { Series1.Add(record.Date, decimal.ToDouble(record.Value)); } this is how data is added to lineseries to plot datapoints on graphs.

"GraphData": [ { "value": 24, "date": "2020-10-23T00:00:00" }, { "value": 35, "date": "2020-10-21T00:00:00" }, { "value": 34, "date": "2020-10-28T00:00:00" }, { "value": 36, "date": "2020-10-20T00:00:00" }, { "value": 25, "date": "2020-10-29T00:00:00" }, { "value": -9, "date": "2020-10-30T00:00:00" }, { "value": -2, "date": "2020-10-31T00:00:00" }, { "value": -26, "date": "2020-11-02T00:00:00" }] this is data passing to lineseries.

even though im passing negative datapoints to plot., its ignoring them and rendering only positive values as shown above

VisualMelon commented 4 years ago

I'm not able to repro this on Winforms (I'm not set up to test Xamarin), and can't recall any bugs like this in the past. Could you confirm which version of Oxyplot you are using?

What is the Add method doing? Can you check that the line series' Points collection is correctly populated, or that ActualPoints (protected property) is populated if you are using an ItemSource.

SwathiAdari27 commented 4 years ago

about version - added as a library not as an dll

add method adds lineseries to plot. not using any ItemSource property to override previous values