Quantcast
Channel: oxyplot Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1267

New Post: AreaChart, define smartly Y axys

$
0
0
Hi,

I still got the same area chart which Y axis is stretched to zero:

Image

What am I missing?

Here's my full code:

         var model = new PlotModel("AAAA", CurrentOrderSold.Identifier.Name);

            var dateTimeAxis = new DateTimeAxis(AxisPosition.Bottom, "Date")
            {
                IntervalType = DateTimeIntervalType.Months,
                StringFormat = "MMM yy",

            };

            model.Axes.Add(dateTimeAxis);
            

            var points = new List<DateValue>();
            foreach (var quote in Quotes.ToList())
                points.Add(new DateValue { Date = quote.TradingDate, Value = quote.Close, Zero = 0 });

            var linearSeries = new LineSeries("Price");

            var list = points.Select(source => new DataPoint(DateTimeAxis.ToDouble(source.Date), Convert.ToDouble(source.Value)))
                            .Cast<IDataPoint>().ToList();

            linearSeries.Points = list;

            var areaSeries = new AreaSeries()
            {
                ItemsSource = points,
                Color = OxyColors.Transparent,
                DataFieldX = "Date",
                DataFieldY = "Value",
                Fill = OxyColor.FromRgb(214, 231, 242),
                DataFieldX2 = "Date",
                DataFieldY2 = "Zero",


            };

            model.Series.Add(areaSeries);
            model.Series.Add(linearSeries);
            PlotModel = model;


  public class DateValue
    {
        public DateTime Date { get; set; }
        public decimal Value { get; set; }
        public decimal Zero { get; set; }
    }
```

Viewing all articles
Browse latest Browse all 1267

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>