コード例 #1
1
        public void SharingSeries()
        {
            var aGuy = new CartesianChart();
            var bGuy = new CartesianChart();

            aGuy.MockIt(new CoreSize(200, 200));
            bGuy.MockIt(new CoreSize(200, 200));

            var aSeries = new LineSeries();

            aGuy.Series.Add(aSeries);
            aGuy.Update();
            Debug.WriteLine(aGuy.Series.Count);

            bGuy.Series.Add(aSeries);
            bGuy.Update();
            Debug.WriteLine(aGuy.Series.Count);
            Debug.WriteLine(bGuy.Series.Count);
        }
コード例 #2
0
        private void BuildPngOnClick(object sender, RoutedEventArgs e)
        {
            var myChart = new LiveCharts.Wpf.CartesianChart
            {
                DisableAnimations = true,
                Width             = 600,
                Height            = 200,
                Series            = new SeriesCollection
                {
                    new LineSeries
                    {
                        Values = new ChartValues <double> {
                            1, 6, 7, 2, 9, 3, 6, 5
                        }
                    }
                }
            };

            var viewbox = new Viewbox();

            viewbox.Child = myChart;
            viewbox.Measure(myChart.RenderSize);
            viewbox.Arrange(new Rect(new Point(0, 0), myChart.RenderSize));
            myChart.Update(true, true); //force chart redraw
            viewbox.UpdateLayout();

            SaveToPng(myChart, "chart.png");
            //png file was created at the root directory.
        }
コード例 #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Chart3.Height            = 500;
            Chart3.Width             = 1000;
            Chart3.AxisX[0].MinValue = double.NaN;
            Chart3.AxisX[0].MaxValue = double.NaN;
            Chart3.AxisY[0].MinValue = double.NaN;
            Chart3.AxisY[0].MaxValue = double.NaN;

            var myChart = new LiveCharts.Wpf.CartesianChart
            {
                DisableAnimations = true,
                Width             = 1200,
                Height            = 400,
                Series            = new SeriesCollection
                {
                    new LineSeries
                    {
                        Title  = "Neutral",
                        Values = cv_net3
                    },
                    new LineSeries
                    {
                        Title  = "Anger",
                        Values = cv_ang3
                    },
                    new LineSeries
                    {
                        Title  = "Disgust",
                        Values = cv_dis3
                    },
                    new LineSeries
                    {
                        Title  = "Fear",
                        Values = cv_fea3
                    },
                    new LineSeries
                    {
                        Title  = "Happy",
                        Values = cv_hap3
                    },
                    new LineSeries
                    {
                        Title  = "Saddness",
                        Values = cv_sad3
                    },
                    new LineSeries
                    {
                        Title  = "Surprise",
                        Values = cv_sur3
                    },
                }
            };
            var viewbox = new Viewbox();

            viewbox.Child = myChart;
            viewbox.Measure(myChart.RenderSize);
            viewbox.Arrange(new Rect(new System.Windows.Point(0, 0), myChart.RenderSize));
            myChart.Update(true, true); //force chart redraw
            viewbox.UpdateLayout();

            SaveToPng(myChart, "chart.png");
            //png file was created at the root directory.

            Chart3.Height = 178;
            Chart3.Width  = 324;
        }