private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Create a chart.
            ChartControl chart = new ChartControl();

            // Create a diagram.
            XYDiagram2D diagram = new XYDiagram2D();

            chart.Diagram = diagram;

            // Create a bar series.
            BarSideBySideSeries2D series = new BarSideBySideSeries2D();

            diagram.Series.Add(series);

            // Add points to the series.
            series.Points.Add(new SeriesPoint("A", 1));
            series.Points.Add(new SeriesPoint("B", 3));
            series.Points.Add(new SeriesPoint("C", 5));
            series.Points.Add(new SeriesPoint("D", 2));
            series.Points.Add(new SeriesPoint("E", 7));

            // Add the chart to the window.
            this.Content = chart;
        }
예제 #2
0
 void InitializeSeries(Series series, int seriesNumber)
 {
     if (series is BarSideBySideSeries2D)
     {
         BarSideBySideSeries2D.SetLabelPosition(series.Label, Bar2DLabelPosition.Outside);
     }
     if (series is BarSeries2D)
     {
         series.DataSource = barDataSource;
     }
     else if (series is LineScatterSeries2D)
     {
         series.DataSource = scatterDataSource;
     }
     else
     {
         series.DataSource = dataSource;
     }
     if (series is LineSeries2D)
     {
         ((LineSeries2D)series).MarkerVisible = true;
     }
     if (series is AreaSeries2D)
     {
         ((AreaSeries2D)series).MarkerVisible = true;
     }
     series.ArgumentDataMember = "Argument";
     series.ValueDataMember    = "Value" + seriesNumber.ToString();
 }
예제 #3
0
        void GetMonthlyChartData()
        {
            BarSideBySideSeries2D barIn  = new BarSideBySideSeries2D();
            BarSideBySideSeries2D barOut = new BarSideBySideSeries2D();

            DateTime recent = DateTime.Now;

            for (int i = 0; i < 5; i++)
            {
            }
        }
예제 #4
0
        public BarSideBySideSeries2D GetGenero(int year)
        {
            BarSideBySideSeries2D serie = new BarSideBySideSeries2D()
            {
                DisplayName = year.ToString()
            };

            //serie.Name = operativo.NombreCompleto;

            foreach (KeyValuePair <string, int> punto in GetGeneroPerYear(year))
            {
                serie.Points.Add(new SeriesPoint(punto.Key, punto.Value));
            }

            return(serie);
        }
예제 #5
0
        void GetDailyChartData()
        {
            XYDiagram2D           diagram2D = new XYDiagram2D();
            BarSideBySideSeries2D barIn     = new BarSideBySideSeries2D();
            BarSideBySideSeries2D barOut    = new BarSideBySideSeries2D();

            //List<DataTable> dataTables = new List<DataTable>();
            DateTime recent = DateTime.Now;

            for (int i = 0; i < 5; i++)
            {
                DataTable table = ReportDAO.Instance.GetDailyReport(recent);
                recent = recent.AddDays(-1);
                foreach (DataRow row in table.Rows)
                {
                }
            }
        }
 void lbChartType_SelectedIndexChanged(object sender, RoutedEventArgs e)
 {
     if (chart != null)
     {
         if (lbChartType.SelectedIndex == 0)
         {
             LineSeries2D lineSeries1 = new LineSeries2D();
             LineSeries2D lineSeries2 = new LineSeries2D();
             lineSeries1.SeriesAnimation = new Line2DUnwrapVerticallyAnimation();
             lineSeries1.PointAnimation  = new Marker2DSlideFromTopAnimation();
             lineSeries2.SeriesAnimation = new Line2DUnwrapVerticallyAnimation()
             {
                 BeginTime = TimeSpan.FromMilliseconds(400)
             };
             lineSeries2.PointAnimation = new Marker2DSlideFromTopAnimation()
             {
                 BeginTime = TimeSpan.FromMilliseconds(400)
             };
             CreateSeries(lineSeries1, lineSeries2);
         }
         else
         {
             BarSideBySideSeries2D barSeries1 = new BarSideBySideSeries2D();
             BarSideBySideSeries2D barSeries2 = new BarSideBySideSeries2D();
             barSeries1.PointAnimation = new Bar2DSlideFromBottomAnimation()
             {
                 PointDelay = TimeSpan.FromMilliseconds(200)
             };
             barSeries2.PointAnimation = new Bar2DSlideFromBottomAnimation()
             {
                 PointDelay = TimeSpan.FromMilliseconds(200),
                 BeginTime  = TimeSpan.FromMilliseconds(100)
             };
             CreateSeries(barSeries1, barSeries2);
         }
         if (!firstRun)
         {
             chart.Animate();
         }
     }
 }
예제 #7
0
 public static ChartControl CreatXYChart(SolidColorBrush forecolor, string ChartTitle, List<ChartDataChartCommonData> dtchart)
 {
     mausac = 0;
     ChartControl abc = new ChartControl();
     XYDiagram2D dg1 = new XYDiagram2D();
     //Tao Tile cho Chart
     Title nt = new Title();
     nt.Content = ChartTitle;
     nt.Foreground = forecolor;
     abc.Titles.Add(nt);
     //Tinh so Series
     List<string> countsr = (from p in dtchart group p by p.Series into g select g.Key).ToList();
     //Creat Diagram
     abc.Diagram = dg1;
     //Begin tao guong
     Pane pane1 = new Pane();
     pane1.MirrorHeight = 100;//Do cao guong
     dg1.DefaultPane = pane1;
     //End tao guong
     //Begin set kieu bieu do
     for (int i = 0; i < countsr.Count; i++)
     {
         BarSideBySideSeries2D dgs1 = new BarSideBySideSeries2D() { DisplayName = countsr[i].ToString() };//Neu ko co DisplayName chu thich khong hien thi
         Quasi3DBar2DModel an1 = new Quasi3DBar2DModel();
         dgs1.Model = an1;
         foreach (ChartDataChartCommonData dr in dtchart)//Tao cac point
         {
             if (dr.Series == countsr.ElementAt(i))
             {
                 //Tao Series
                 SeriesPoint sr1 = new SeriesPoint();
                 sr1.Argument = dr.Agrument;
                 sr1.Value = dr.Value;
                 sr1.Tag = mausac.ToString();
                 dgs1.Points.Add(sr1);
                 mausac++;
             }
         }
         SeriesLabel lbl1 = new SeriesLabel();
         dgs1.LabelsVisibility = true;//Hien thi Lablel cho tung vung
         lbl1.Indent = 10;
         lbl1.ConnectorThickness = 1;
         lbl1.ResolveOverlappingMode = ResolveOverlappingMode.Default;
         dgs1.Label = lbl1;
         dg1.Series.Add(dgs1);
     }
     //Tao chu thich
     abc.Legend = new Legend()
     {
         VerticalPosition = VerticalPosition.BottomOutside,
         HorizontalPosition = HorizontalPosition.Center,
         Orientation = Orientation.Horizontal
     };
     //End tao chu thich
     return abc;
 }
예제 #8
0
        public static ChartControl CreatXYChart(SolidColorBrush forecolor, string ChartTitle, List <ChartDataChartCommonData> dtchart)
        {
            mausac = 0;
            ChartControl abc = new ChartControl();
            XYDiagram2D  dg1 = new XYDiagram2D();
            //Tao Tile cho Chart
            Title nt = new Title();

            nt.Content    = ChartTitle;
            nt.Foreground = forecolor;
            abc.Titles.Add(nt);
            //Tinh so Series
            List <string> countsr = (from p in dtchart group p by p.Series into g select g.Key).ToList();

            //Creat Diagram
            abc.Diagram = dg1;
            //Begin tao guong
            Pane pane1 = new Pane();

            pane1.MirrorHeight = 100;//Do cao guong
            dg1.DefaultPane    = pane1;
            //End tao guong
            //Begin set kieu bieu do
            for (int i = 0; i < countsr.Count; i++)
            {
                BarSideBySideSeries2D dgs1 = new BarSideBySideSeries2D()
                {
                    DisplayName = countsr[i].ToString()
                };                                                                                               //Neu ko co DisplayName chu thich khong hien thi
                Quasi3DBar2DModel an1 = new Quasi3DBar2DModel();
                dgs1.Model = an1;
                foreach (ChartDataChartCommonData dr in dtchart)//Tao cac point
                {
                    if (dr.Series == countsr.ElementAt(i))
                    {
                        //Tao Series
                        SeriesPoint sr1 = new SeriesPoint();
                        sr1.Argument = dr.Agrument;
                        sr1.Value    = dr.Value;
                        sr1.Tag      = mausac.ToString();
                        dgs1.Points.Add(sr1);
                        mausac++;
                    }
                }
                SeriesLabel lbl1 = new SeriesLabel();
                dgs1.LabelsVisibility       = true;//Hien thi Lablel cho tung vung
                lbl1.Indent                 = 10;
                lbl1.ConnectorThickness     = 1;
                lbl1.ResolveOverlappingMode = ResolveOverlappingMode.Default;
                dgs1.Label = lbl1;
                dg1.Series.Add(dgs1);
            }
            //Tao chu thich
            abc.Legend = new Legend()
            {
                VerticalPosition   = VerticalPosition.BottomOutside,
                HorizontalPosition = HorizontalPosition.Center,
                Orientation        = Orientation.Horizontal
            };
            //End tao chu thich
            return(abc);
        }