SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

0 votes
2k views

Hi all,

When I have a data series that there are a small range data between 2 big range data, mountain chart does not show small data until I zoom in.

Question: how can I show small data even I don’t zoom in the chart?

This is my source code:

    private void SplineChartExampleView_Loaded(object sender, RoutedEventArgs e)
    {
        var date = DateTime.Now;
        var dataSeries = new XyDataSeries<DateTime, double> { SeriesName = "Pork" };
        dataSeries.Append(date, 2);

        date = date.AddDays(10);
        dataSeries.Append(date, 2);

        date = date.AddMinutes(10);
        dataSeries.Append(date, 2);

        date = date.AddDays(10);
        dataSeries.Append(date, 2);

        dataSeries.SeriesName = "Test";
        var newLineRenderableSeries1 = new FastMountainRenderableSeries()
        {
            StrokeThickness = 0,
            RenderSize = Size.Empty,
            IsHitTestVisible = true,
            IsManipulationEnabled = true,
            AntiAliasing = true,
            LayoutTransform = Transform.Identity,
            SnapsToDevicePixels = false,
            DataSeries = dataSeries,
            PaletteProvider = new BarPaletteProvider()
        };

        sciChart.RenderableSeries.Add(newLineRenderableSeries1);


        sciChart.ZoomExtents();
    }

    public sealed class BarPaletteProvider : IFillPaletteProvider
    {
        public void OnBeginSeriesDraw(IRenderableSeries rSeries)
        {
        }

        public Brush OverrideFillBrush(IRenderableSeries rSeries, int index, IPointMetadata metadata)
        {
            if (index == 0)
                return Brushes.White;

            var colorIndex = index % 5;

            switch (colorIndex)
            {
                case 1:
                    return Brushes.Red;
                case 2:
                    return Brushes.Yellow;
                case 3:
                    return Brushes.Blue;
                case 4:
                    return Brushes.Green;
                case 5:
                    return Brushes.White;

            }

            return Brushes.Aqua;
        }
    }

Thanks!

  • Nhan Phan asked 3 years ago
  • last active 3 years ago
Showing 1 result
This template supports the sidebar's widgets. Add one or use Full Width layout.