Click here to Skip to main content
15,922,650 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,
I want to do that,
lineseris1 and Y1 depends on each other.(Y1 is left axis)
lineseris2 and Y2 depends on each other.(Y2 is right axis)

When I keep to press the right click ,I am dragging the lineseries and just changing left axis(lineseries1),I want it to move both axis(left and right axis).
Also,
When the lineseries1 rescale according to receiving values,left axis must change .
When the lineseries2 rescale according to receiving values,right axis must change.

What I have tried:

<pre lang="c#">        

 LineSeries lineSeries1 = new LineSeries
        {
            StrokeThickness = 2,

            Title = "Value1",
            Smooth = false,
            Color = OxyColor.FromArgb(255, 78, 154, 6),
            MarkerFill = OxyColor.FromArgb(255, 78, 5, 6),
            MarkerStroke = OxyColors.ForestGreen,
            MarkerType = MarkerType.Circle,
            DataFieldX = "Date",
            DataFieldY = "Value"    
        };

        LineSeries lineSeries2 = new LineSeries
        {
            StrokeThickness = 2,
            CanTrackerInterpolatePoints = true,
            Title = "Value2",
            Smooth = true
        };

        LinearAxis linearAxisY1 = new LinearAxis {
            Title = "Y1",
            Position = AxisPosition.Left,
            MajorGridlineColor = OxyColor.FromArgb(40, 100, 0, 139),
            MajorGridlineStyle = LineStyle.Solid,
            MinorGridlineColor = OxyColor.FromArgb(20, 0, 0, 139),
            MinorGridlineStyle = LineStyle.Solid
        };

        LinearAxis linearAxisY2 = new LinearAxis {
            Title = "Y2",
            Position = AxisPosition.Right,
        };

        LinearAxis linearAxisX1 = new LinearAxis
        {
            Title = "X1",
            Position = AxisPosition.Bottom,
            MajorGridlineColor = OxyColor.FromArgb(40, 0, 0, 139),
            MajorGridlineStyle = LineStyle.Solid,
            MinorGridlineColor = OxyColor.FromArgb(20, 0, 0, 139),
            MinorGridlineStyle = LineStyle.Solid

        };

 pv.Model = new PlotModel() {Title="ABC", Background = OxyColors.Beige };

            
            pv.Model.InvalidatePlot(true);
            pv.Model.Axes.Clear();

            //pv.Model.Axes.Add(linearAxisX1);
            pv.Model.Axes.Add(linearAxisY1);
            pv.Model.Axes.Add(linearAxisY2);

            pv.Model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Solid,
 
            });

            
            lineSeries1.Points.Clear();

            pv.Model.Series.Add(lineSeries1);
            pv.Model.Series.Add(lineSeries2);
Posted
Updated 13-Feb-18 3:15am

1 solution

Why not use the Oxyplot recommended resources for support: [^]
Quote:
Questions
Use the discussion forum at discussion.oxyplot.org if you have questions regarding the library. You can also try the chat room, Stack Overflow or the Xamarin forum.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900