Ejemplo n.º 1
0
        public void DisconnectPlotModel()
        {
            plotBasicGraph.ResetAllAxes();
            LineSerie.Points.Clear();
            LineSerie.ClearSelection();
            plotBasicGraph.Series.Clear();
            plotBasicGraph = new PlotModel();

            PlotCorrelatedGraph.ResetAllAxes();
            LineSerieCorrelated.Points.Clear();
            LineSerieCorrelated.ClearSelection();
            PlotCorrelatedGraph.Series.Clear();
            PlotCorrelatedGraph = new PlotModel();

            PlotBothFeaturesGraph.ResetAllAxes();
            LineRegression.Points.Clear();
            LineRegression.ClearSelection();
            LineSerieBothFeatures.Points.Clear();
            LineSerieBothFeatures.ClearSelection();
            PlotBothFeaturesGraph.Series.Clear();
            PlotBothFeaturesGraph = new PlotModel();

            plotBasicGraph.InvalidatePlot(true);
            PlotCorrelatedGraph.InvalidatePlot(true);
            PlotBothFeaturesGraph.InvalidatePlot(true);
        }
Ejemplo n.º 2
0
        public void FirstTest(int num)
        {
            var data = new List <decimal>()
            {
                GetNum(),
                GetNum(),
                GetNum(),
                GetNum(),
                GetNum(),
                GetNum(),
                GetNum()
            };

            var series = new List <ISerie>();

            var lineSerie = new LineSerie()
            {
                Data = data
            };

            series.Add(lineSerie);

            var x = new XAxis()
            {
                Data = new List <string>()
                {
                    "星期一",
                    "星期二",
                    "星期三",
                    "星期四",
                    "星期五",
                    "星期六",
                    "星期日"
                }
            };

            var y = new YAxis();

            var option = new Option()
            {
                Series = series,
                XAxis  = x,
                YAxis  = y
            };

            //var result = _reportService.GetHtml(option);

            string saveUrl = Path.Combine(Environment.CurrentDirectory, $"{num}.html");

            //File.WriteAllText(saveUrl, result);
        }
Ejemplo n.º 3
0
        private void AddSerie(object sender, RoutedEventArgs e)
        {
            var r = new Random();

            var s = new LineSerie {
                PrimaryValues = new ObservableCollection <double>()
            };
            var lineSerie = LineChart.Series.Count > 0 ? (LineChart.Series[0] as LineSerie) : null;

            if (lineSerie != null)
            {
                var l = LineChart.Series.Count == 0 ? 0 : lineSerie.PrimaryValues.Count;
                for (int i = 0; i < l; i++)
                {
                    s.PrimaryValues.Add(r.Next(-30, 30));
                }
            }
            else
            {
                s = new LineSerie
                {
                    PrimaryValues = new ObservableCollection <double>(new double[] { 1, -1, 2, -2, 3, -3, 4, -4, 5, -5 })
                };
            }

            LineChart.Series.Add(s);

            var s1 = new BarSerie {
                PrimaryValues = new ObservableCollection <double>()
            };
            var barSerie = BarChart.Series.Count > 0 ? BarChart.Series[0] as BarSerie : null;

            if (barSerie != null)
            {
                var l1 = BarChart.Series.Count == 0 ? 0 : barSerie.PrimaryValues.Count;
                for (int i = 0; i < l1; i++)
                {
                    s1.PrimaryValues.Add(r.Next(0, 30));
                }
            }
            else
            {
                s1 = new BarSerie
                {
                    PrimaryValues = new ObservableCollection <double>(new double[] { 1, 2, 3, 4, 5 })
                };
            }
            BarChart.Series.Add(s1);

            var s2 = new StackedBarSerie {
                PrimaryValues = new ObservableCollection <double>()
            };
            var stackedSerie = StackedBarChart.Series.Count > 0 ? StackedBarChart.Series[0] as StackedBarSerie : null;

            if (stackedSerie != null)
            {
                var l1 = StackedBarChart.Series.Count == 0 ? 0 : stackedSerie.PrimaryValues.Count;
                for (int i = 0; i < l1; i++)
                {
                    s2.PrimaryValues.Add(r.Next(0, 30));
                }
            }
            else
            {
                s2 = new StackedBarSerie
                {
                    PrimaryValues = new ObservableCollection <double>(new double[] { 1, 2, 3, 4, 5 })
                };
            }
            StackedBarChart.Series.Add(s2);

            var s8 = new RadarSerie {
                PrimaryValues = new ObservableCollection <double>()
            };
            var radarSerie = RadarChart.Series.Count > 0 ? RadarChart.Series[0] as RadarSerie : null;

            if (radarSerie != null)
            {
                var l1 = RadarChart.Series.Count == 0 ? 0 : radarSerie.PrimaryValues.Count;
                for (int i = 0; i < l1; i++)
                {
                    s8.PrimaryValues.Add(r.Next(0, 30));
                }
            }
            else
            {
                s8 = new RadarSerie
                {
                    PrimaryValues = new ObservableCollection <double>(new double[] { 1, 2, 3, 4, 5 })
                };
            }
            RadarChart.Series.Add(s8);
        }