Esempio n. 1
0
        public override void Do(IDemoChartControl chartControl)
        {
            // Create custom data reader.
            var dataReader = new CustomSeriesDataReader(PointCount);

            // Create series.
            var series = new Series
            {
                // Set data reader.
                Reader = dataReader,
                // Set series line color.
                Color = Colors.Blue,
                // Set series line thickness.
                Thickness = 2.0f,
                // Set series line pattern style.
                PatternStyle = PatternStyle.Solid,
                // Set series marker color.
                MarkerColor = Colors.Red,
                // Set series marker style.
                MarkerStyle = MarkerStyle.Cross,
                // Set name.
                Name = "Line"
            };

            // Setup chart view settings.
            chartControl.ContextView.Camera2D.Projection = Projection2DTypes.XPosYPos;
            chartControl.ContextView.Mode2D = true;
            chartControl.ViewResetOptions.ResetOnDataChanged = false;

            // Setup chart data source.
            chartControl.DataSource = series;

            // Start animation.
            animationHelper.Start(value => value, value => dataReader.RandomizePoint(5f, 25), 0f, 0f, 25);
        }
        public override void Do(IDemoChartControl chartControl)
        {
            List <RenderData> renderDatas = new List <RenderData>();

            for (int i = 0; i < SeriesCount; i++)
            {
                // Create custom data reader.
                var dataReader = new CustomSeriesDataReader(PointCount, 1f, i);
                dataReaders.Add(dataReader);

                // Create series.
                Color4 color  = DemoHelper.RandomizeColor();
                var    series = new Series
                {
                    // Set data reader.
                    Reader = dataReader,
                    // Set series line color.
                    Color = color,
                    // Set series line thickness.
                    Thickness = 2f,
                    // Set series line pattern style.
                    PatternStyle = PatternStyle.Solid,
                    // Set series marker style.
                    MarkerStyle = markers[i % markers.Length],
                    // Set marker size.
                    MarkerSize = 12,
                    // Set marker color.
                    MarkerColor = color,
                    // Set name.
                    Name = $"Line {i}"
                };
                renderDatas.Add(series);
            }

            // Setup chart view settings.
            chartControl.ContextView.Camera2D.Projection = Projection2DTypes.XPosYPos;
            chartControl.ContextView.Mode2D = true;

            // Tell the chart that we wanna update view on bounds change.
            chartControl.ViewResetOptions.ResetOnDataChanged = true;

            // Setup chart data source.
            chartControl.DataSource = renderDatas;

            // Start animation.
            animationHelper.Start(value => value, value =>
            {
                foreach (CustomSeriesDataReader dataReader in dataReaders)
                {
                    dataReader.RandomizePoint();
                }
            }, 0f, 0f, 25);
        }