示例#1
0
        private void labelsToggle(bool labelsToggled)
        {
            // Show Labels.
            if (labelsToggled)
            {
                BubbleChart.DataTooltip = null;

                foreach (ScatterSeries series in SeriesCollection)
                {
                    series.DataLabels = true;
                }
            }
            else   // Hide Labels.
            {
                DefaultTooltip newTooltip = new DefaultTooltip();

                newTooltip.ShowSeries = false;

                newTooltip.Background = Brushes.DimGray;

                newTooltip.Foreground = Brushes.White;

                newTooltip.FontSize = 15;

                newTooltip.FontWeight = FontWeights.Bold;

                BubbleChart.DataTooltip = newTooltip;

                foreach (ScatterSeries series in SeriesCollection)
                {
                    series.DataLabels = false;
                }
            }
        }
示例#2
0
        public void AccidentsComparison(List <Report> reports)
        {
            GenerateChartLabel("Accidents Comparison", new Point(80, 320));

            LiveCharts.WinForms.PieChart pieChart1 = new LiveCharts.WinForms.PieChart();
            pieChart1.InnerRadius    = 20;
            pieChart1.LegendLocation = LegendLocation.Bottom;
            AddChartToForm(pieChart1, new Point(80, 360));

            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.OnlySender
            };
            Func <ChartPoint, string> labelPoint = chartPoint =>
                                                   string.Format("{0} ({1:P})", chartPoint.Y, chartPoint.Participation);

            pieChart1.DataTooltip = tooltip;

            pieChart1.Series = new SeriesCollection();
            reports.ForEach(r =>
            {
                pieChart1.Series.Add(new PieSeries
                {
                    Title  = r.Name,
                    Values = new ChartValues <double> {
                        r.Accidents
                    },
                    LabelPoint = labelPoint,
                    DataLabels = true
                });
            });
        }
示例#3
0
        public void PlanedTimeAndActualTime()
        {
            LiveCharts.WinForms.CartesianChart cartesianChart1 = new LiveCharts.WinForms.CartesianChart();

            cartesianChart1.Series = new SeriesCollection
            {
                new RowSeries
                {
                    Title  = "Time",
                    Values = new ChartValues <double> {
                        data.GetPlannedTiming().TotalSeconds, data.GetActualTiming().TotalSeconds
                    }
                }
            };

            cartesianChart1.AxisY.Add(new Axis
            {
                Labels = new[] { "Planned Time ", "Actual Time" }
            });

            cartesianChart1.AxisX.Add(new Axis
            {
                LabelFormatter = value => value + " Seconds"
            });

            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart1.DataTooltip = tooltip;
            GenerateChartLabel("Total Planned Time/ Actual Time", new Point(550, 620));
            AddChartToForm(cartesianChart1, new Point(550, 660));
        }
示例#4
0
        public override void SetToolTip()
        {
            wLabel   L = DataGrid.Sets[0].Points[0].ToolTip;
            wGraphic G = L.Graphics;
            wFont    F = G.FontObject;

            DefaultTooltip Tip = (DefaultTooltip)Element.DataTooltip;

            Tip.SelectionMode = TooltipSelectionMode.OnlySender;

            if (L.Enabled)
            {
                Tip.BulletSize = 0;

                Tip.ShowSeries = false;
                Tip.Background = G.GetBackgroundBrush();
                Tip.Foreground = F.GetFontBrush();

                Tip.BorderBrush     = G.GetStrokeBrush();
                Tip.BorderThickness = G.GetStroke();

                Tip.FontFamily = F.ToMediaFont().Family;
                Tip.FontSize   = F.Size;
                Tip.FontStyle  = F.ToMediaFont().Italic;
                Tip.FontWeight = F.ToMediaFont().Bold;
            }

            Element.DataTooltip = Tip;
        }
        private void SetGraphData(List <int> Values, List <string> Labels)
        {
            cartesianChart1.Series.Clear();
            cartesianChart1.AxisX.Clear();
            cartesianChart1.AxisY.Clear();

            cartesianChart1.Series = new SeriesCollection
            {
                new RowSeries
                {
                    Title  = "Tracks",
                    Values = new ChartValues <int> (Values)
                }
            };

            cartesianChart1.AxisY.Add(new Axis
            {
                Labels = Labels
            });

            cartesianChart1.AxisX.Add(new Axis
            {
                LabelFormatter = value => value.ToString("N")
            });

            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };
        }
示例#6
0
        public void TotalDrivingTimePerAlgorithm()
        {
            LiveCharts.WinForms.CartesianChart cartesianChart1 = new LiveCharts.WinForms.CartesianChart();

            cartesianChart1.Series = new SeriesCollection
            {
                new RowSeries
                {
                    Title  = "Time",
                    Values = new ChartValues <double> {
                        data.GetAlgorithmsTiming()[0].TotalSeconds, data.GetAlgorithmsTiming()[1].TotalSeconds
                    }
                }
            };

            cartesianChart1.AxisY.Add(new Axis
            {
                Labels = new[] { "Dijkstra ", "A* Search" }
            });

            cartesianChart1.AxisX.Add(new Axis
            {
                LabelFormatter = value => value + " Seconds"
            });

            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart1.DataTooltip = tooltip;
            GenerateChartLabel("Total Driving Time Per Algorithm", new Point(100, 620));
            AddChartToForm(cartesianChart1, new Point(100, 660));
        }
示例#7
0
        public void LineChartConfigure2()
        {
            var lineTempTS1Series = new LineSeries();

            lineTempTS1Series.Title  = "Độ ẩm sấy";
            lineTempTS1Series.Values = new ChartValues <ObservableValue>
            {
                new ObservableValue(0)
            };
            lineTempTS1Series.PointGeometrySize = 6;

            var lineTempTS2Series = new LineSeries();

            lineTempTS2Series.Title  = "Độ ẩm đặt";
            lineTempTS2Series.Values = new ChartValues <ObservableValue>
            {
                new ObservableValue(0)
            };
            lineTempTS2Series.PointGeometrySize = 6;


            cartesianChart2.Series = new SeriesCollection
            {
                lineTempTS1Series,
                lineTempTS2Series,
            };
            //
            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart2.DataTooltip    = tooltip;
            cartesianChart2.LegendLocation = LegendLocation.Bottom;
        }
        public BasicsStackedRowExample()
        {
            InitializeComponent();

            cartesianChart1.Series = new SeriesCollection
            {
                new StackedRowSeries
                {
                    Values = new ChartValues <double> {
                        4, 5, 6, 8
                    },
                    StackMode  = StackMode.Percentage,
                    DataLabels = true,
                    LabelPoint = p => p.X.ToString()
                },
                new StackedRowSeries
                {
                    Values = new ChartValues <double> {
                        2, 5, 6, 7
                    },
                    StackMode  = StackMode.Percentage,
                    DataLabels = true,
                    LabelPoint = p => p.X.ToString()
                }
            };

            //adding series updates and animates the chart
            cartesianChart1.Series.Add(new StackedRowSeries
            {
                Values = new ChartValues <double> {
                    6, 2, 7
                },
                StackMode  = StackMode.Percentage,
                DataLabels = true,
                LabelPoint = p => p.X.ToString()
            });

            //adding values also updates and animates
            cartesianChart1.Series[2].Values.Add(4d);

            cartesianChart1.AxisY.Add(new Axis
            {
                Title  = "Browser",
                Labels = new[] { "Chrome", "Mozilla", "Opera", "IE" }
            });
            cartesianChart1.AxisX.Add(new Axis
            {
                LabelFormatter = val => val.ToString("P")
            });

            var tooltip = new DefaultTooltip {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart1.DataTooltip = tooltip;
        }
示例#9
0
        private void Bar_Chart_Load(object sender, EventArgs e)
        {
            salesBindingSource1.DataSource = new List <Sales>();
            //var get_sales_Sales_Man = (from salesObject in salesBindingSource.DataSource as List<Sales>
            //                           select new { salesObject.Sales_Man }).Distinct();
            //int size = get_sales_Sales_Man.Count();
            //richTextBox1.Text = size.ToString();
            //string[] salesManNames = new string[size];
            //int counter = 0;

            //foreach (var item in get_sales_Sales_Man)
            //{
            //    if (counter <= size)
            //    {
            //        salesManNames.SetValue(item.Sales_Man, counter);
            //        counter++;
            //    }
            //}
            cartesianChartBar.Series.Clear();
            cartesianChartRow.Series.Clear();
            cartesianChartBar.AxisX.Add(new Axis
            {
                Title  = "Sales Man",
                Labels = new[] { "Aymal", "Ali" }
            });

            cartesianChartBar.AxisY.Add(new Axis
            {
                Title          = "Sold Apps",
                LabelFormatter = value => value.ToString("N")
            });
            cartesianChartRow.AxisY.Add(new Axis
            {
                Labels = new[] { "Aymal", "Ali" }
            });

            cartesianChartRow.AxisX.Add(new Axis
            {
                LabelFormatter = value => value.ToString("N")
            });

            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChartRow.DataTooltip = tooltip;
        }
示例#10
0
        public void SimulationsPerGrid()
        {
            GenerateChartLabel("Number of Simulations" + "\n" + "Per Grid Size", new Point(80, 10));

            LiveCharts.WinForms.PieChart pieChart1 = new LiveCharts.WinForms.PieChart();
            pieChart1.InnerRadius    = 30;
            pieChart1.LegendLocation = LegendLocation.Right;
            AddChartToForm(pieChart1, new Point(100, 66));

            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.OnlySender
            };

            pieChart1.DataTooltip = tooltip;

            pieChart1.Series = new SeriesCollection
            {
                new PieSeries
                {
                    Title  = "Small",
                    Values = new ChartValues <double> {
                        data.GetSmallGridSimulationsCount()
                    },
                    PushOut    = 5,
                    DataLabels = true
                },
                new PieSeries
                {
                    Title  = "Medium",
                    Values = new ChartValues <double> {
                        data.GetMediumGridSimulationsCount()
                    },
                    DataLabels = true
                },
                new PieSeries
                {
                    Title  = "Large",
                    Values = new ChartValues <double> {
                        data.GetLargeGridSimulationsCount()
                    },
                    DataLabels = true
                },
            };
        }
示例#11
0
        public BasicRowExample()
        {
            InitializeComponent();

            cartesianChart1.Series = new SeriesCollection
            {
                new RowSeries
                {
                    Title  = "2015",
                    Values = new ChartValues <double> {
                        10, 50, 39, 50
                    }
                }
            };

            //adding series will update and animate the chart automatically
            cartesianChart1.Series.Add(new RowSeries
            {
                Title  = "2016",
                Values = new ChartValues <double> {
                    11, 56, 42
                }
            });

            //also adding values updates and animates the chart automatically
            cartesianChart1.Series[1].Values.Add(48d);

            cartesianChart1.AxisY.Add(new Axis
            {
                Labels = new[] { "Maria", "Susan", "Charles", "Frida" }
            });

            cartesianChart1.AxisX.Add(new Axis
            {
                LabelFormatter = value => value.ToString("N")
            });

            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart1.DataTooltip = tooltip;
        }
示例#12
0
        public NegativeStackedRow()
        {
            InitializeComponent();

            cartesianChart1.Series = new SeriesCollection
            {
                new StackedRowSeries
                {
                    Title  = "Male",
                    Values = new ChartValues <double> {
                        .5, .7, .8, .8, .6, .2, .6
                    }
                },
                new StackedRowSeries
                {
                    Title  = "Female",
                    Values = new ChartValues <double> {
                        -.5, -.7, -.8, -.8, -.6, -.2, -.6
                    }
                }
            };

            cartesianChart1.AxisX.Add(new Axis
            {
                Title  = "Age Range",
                Labels = new[] { "0-20", "20-35", "35-45", "45-55", "55-65", "65-70", ">70" }
            });

            cartesianChart1.AxisY.Add(new Axis
            {
                LabelFormatter = value => Math.Abs(value).ToString("P")
            });

            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart1.DataTooltip = tooltip;
        }
示例#13
0
        public InvertedSeries()
        {
            InitializeComponent();

            cartesianChart1.Series.Add(new VerticalLineSeries
            {
                Values = new ChartValues <double> {
                    3, 5, 2, 6, 2, 7, 1
                }
            });

            cartesianChart1.Series.Add(new RowSeries
            {
                Values = new ChartValues <double> {
                    6, 2, 6, 3, 2, 7, 2
                }
            });

            cartesianChart1.AxisY.Add(new Axis
            {
                Separator = new Separator {
                    Step = 1
                }
            });

            cartesianChart1.AxisX.Add(new Axis
            {
                MinValue = 0
            });

            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart1.DataTooltip = tooltip;
        }
示例#14
0
        private void WorkBook_Load(object sender, EventArgs e)
        {
            labelBasicStacked.Visible  = false;
            labelLineChart.Visible     = false;
            labelDoughNutChart.Visible = false;
            labelRowChart.Visible      = false;
            labelColumnChart.Visible   = false;
            labelPieChart.Visible      = false;
            labelSelectChart.Visible   = false;

            pictureBoxColumn.Visible         = false;
            pictureBoxPie.Visible            = false;
            pictureBoxRow.Visible            = false;
            pictureBoxDoughNut.Visible       = false;
            pictureBoxStacked.Visible        = false;
            pictureBoxLine.Visible           = false;
            pieChart_Population.Visible      = false;
            cartesianChartStacked.Visible    = false;
            cartesianChartLine.Visible       = false;
            labelLineChart.Visible           = false;
            pictureBoxLine.Visible           = false;
            cartesianChart_Basic_Row.Visible = false;
            //Intialization OF charts
            //Pie_Chart Intialization
            Func <ChartPoint, string> labelPoint = chartPoint =>
                                                   string.Format("{0} ({1:P})", chartPoint.Y, chartPoint.Participation);

            //Dough-Nut Chart
            pieChart1.InnerRadius    = 50;
            pieChart1.LegendLocation = LegendLocation.Right;
            // Stacked_Chart Intialization
            cartesianChartStacked.AxisX.Add(new Axis
            {
                Title     = "Browser",
                Labels    = new[] { "Chrome", "Mozilla", "Opera", "IE" },
                Separator = DefaultAxes.CleanSeparator
            });
            cartesianChartStacked.AxisY.Add(new Axis
            {
                Title          = "Usage",
                LabelFormatter = value => value + "MILLION"
            });
            //Line Chart Intialization
            cartesianChartLine.AxisX.Add(new Axis
            {
                Title  = "Month",
                Labels = new[] { "Jan", "Feb", "Mar", "Apr", "May" }
            });

            cartesianChartLine.AxisY.Add(new Axis
            {
                Title          = "Sales",
                LabelFormatter = value => value.ToString("C")
            });
            cartesianChartLine.LegendLocation = LegendLocation.Right;
            // column Chart intialization
            cartesianChartBasicColumn.AxisX.Add(new Axis
            {
                Title  = "Animals",
                Labels = new[] { "Cats", "Dogs", "Bears" }
            });

            cartesianChartBasicColumn.AxisY.Add(new Axis
            {
                Title          = "Value",
                LabelFormatter = value => value.ToString("N")
            });
            cartesianChartBasicColumn.LegendLocation = LegendLocation.Right;
            // Row Chart Intialization
            cartesianChart_Basic_Row.AxisY.Add(new Axis
            {
                Labels = new[] { "Aymal", "Wajahat", "Ali" }
            });
            cartesianChart_Basic_Row.AxisX.Add(new Axis
            {
                LabelFormatter = value => value.ToString("N") + "Ten"
            });
            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart_Basic_Row.DataTooltip = tooltip;
        }
示例#15
0
        public static Tuple <Axis, Axis, List <Series> > ConfigureChartByChartType(
            string SeriesChartType,
            List <string> lstBoxSelectedStringValues)
        {
            DefaultTooltip defaultTooltip = new DefaultTooltip();

            defaultTooltip.SelectionMode = TooltipSelectionMode.OnlySender;

            Axis AbscissaAxis = new Axis()
            {
                Separator = new Separator()
                {
                    Step = 1, IsEnabled = false
                },
                Title          = "Date",
                Labels         = lstBoxSelectedStringValues,
                LabelsRotation = 20,
                FontSize       = 16
            };

            Axis OrdinateAxis = new Axis()
            {
                Title          = "Time Duration (hrs)",
                FontSize       = 16,
                LabelFormatter = v => v.ToString("N0")
            };

            switch (SeriesChartType)
            {
            case "Column":
                ColumnSeries columnSeries = new ColumnSeries()
                {
                    Title      = "GeneratorOn (hrs)",
                    DataLabels = true,
                    Values     = new ChartValues <double>()
                };
                List <Series> columnSeriesList = new List <Series>();
                columnSeriesList.Add(columnSeries);

                return(new Tuple <Axis, Axis, List <Series> >(
                           OrdinateAxis,
                           AbscissaAxis,
                           columnSeriesList));

            case "Stacked Column":
                StackedColumnSeries stackedColumnSeries = new StackedColumnSeries()
                {
                    DataLabels = true,
                    Values     = new ChartValues <double>()
                };
                List <Series> stackedColumnSeriesList = new List <Series>();
                stackedColumnSeriesList.Add(stackedColumnSeries);

                return(new Tuple <Axis, Axis, List <Series> >(
                           OrdinateAxis,
                           AbscissaAxis,
                           stackedColumnSeriesList));

            case "Stacked Area":
                StackedAreaSeries stackedAreaSeries = new StackedAreaSeries()
                {
                    DataLabels = true,
                    Values     = new ChartValues <DateTimePoint>()
                };
                List <Series> stackedAreaSeriesList = new List <Series>();
                stackedAreaSeriesList.Add(stackedAreaSeries);

                return(new Tuple <Axis, Axis, List <Series> >(
                           OrdinateAxis,
                           AbscissaAxis,
                           stackedAreaSeriesList));

            case "Line":
                LineSeries lineSeries = new LineSeries()
                {
                    Title      = "GeneratorOn (hrs)",
                    DataLabels = true,
                    Values     = new ChartValues <double>()
                };
                List <Series> lineSeriesList = new List <Series>();
                lineSeriesList.Add(lineSeries);

                return(new Tuple <Axis, Axis, List <Series> >(
                           OrdinateAxis,
                           AbscissaAxis,
                           lineSeriesList));

            case "Pie":
                PieSeries pieSeries = new PieSeries()
                {
                    Title      = "GeneratorOn (hrs)",
                    DataLabels = true,
                    Values     = new ChartValues <double>()
                };
                List <Series> pieSeriesList = new List <Series>();
                pieSeriesList.Add(pieSeries);

                return(new Tuple <Axis, Axis, List <Series> >(
                           OrdinateAxis,
                           AbscissaAxis,
                           pieSeriesList));

            default:
                break;
            }
            return(null);
        }
示例#16
0
        private void Example7_Load(object sender, EventArgs e)
        {
            cartesianChart1.Series = new SeriesCollection
            {
                new RowSeries
                {
                    Title  = "2015",
                    Values = new ChartValues <double> {
                        10, 50, 39, 50
                    }
                }
            };

            //adding series will update and animate the chart automatically
            cartesianChart1.Series.Add(new RowSeries
            {
                Title  = "2016",
                Values = new ChartValues <double> {
                    11, 56, 42
                }
            });

            //also adding values updates and animates the chart automatically
            cartesianChart1.Series[1].Values.Add(48d);

            cartesianChart1.AxisY.Add(new Axis
            {
                Labels = new[] { "Maria", "Susan", "Charles", "Frida" }
            });

            cartesianChart1.AxisX.Add(new Axis
            {
                LabelFormatter = value => value.ToString("N")
            });

            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart1.DataTooltip = tooltip;



            cartesianChart2.Series = new SeriesCollection
            {
                new ColumnSeries
                {
                    Title  = "2015",
                    Values = new ChartValues <double> {
                        10, 50, 39, 50
                    }
                }
            };

            //adding series will update and animate the chart automatically
            cartesianChart2.Series.Add(new ColumnSeries
            {
                Title  = "2016",
                Values = new ChartValues <double> {
                    11, 56, 42
                }
            });

            //also adding values updates and animates the chart automatically
            cartesianChart2.Series[1].Values.Add(48d);

            cartesianChart2.AxisX.Add(new Axis
            {
                Title  = "Sales Man",
                Labels = new[] { "Maria", "Susan", "Charles", "Frida" }
            });

            cartesianChart2.AxisY.Add(new Axis
            {
                Title          = "Sold Apps",
                LabelFormatter = value => value.ToString("N")
            });
        }
示例#17
0
        public static void BindChartData(LiveCharts.WinForms.CartesianChart stringBarChart, LiveCharts.WinForms.PieChart stringPieChart)
        {
            ClearChart(stringBarChart, stringPieChart);

            if (stringListValuePairs.Any())
            {
                Random            randomColorGenerator = new Random();
                ChartValues <int> occurrences          = new ChartValues <int>();
                List <string>     yAxisValues          = new List <string>();
                int i = 0;
                foreach (KeyValuePair <string, int> keyValuePair in stringListValuePairs)
                {
                    if (!string.IsNullOrWhiteSpace(keyValuePair.Key))
                    {
                        occurrences.Add(keyValuePair.Value);
                        yAxisValues.Add(keyValuePair.Key);
                    }
                    i++;
                }
                if (i > 100)
                {
                    MessageBoxProcessor.Show("Bei mehr als 100 Einträgen müssen Sie heranzoomen um die einzelnen Einträge richtig anzuzigen." + Environment.NewLine + "Nutzen Sie hierzu das Scrollrad", "Viele Einträge", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                #region stringBarChart

                var tooltip = new DefaultTooltip
                {
                    SelectionMode = TooltipSelectionMode.SharedYValues
                };

                SolidColorBrush barBrush = new SolidColorBrush(System.Windows.Media.Color.FromRgb((byte)randomColorGenerator.Next(255), (byte)randomColorGenerator.Next(255), (byte)randomColorGenerator.Next(255)));
                stringBarChart.Series.Add(new RowSeries
                {
                    Title           = "Anzahl",
                    Values          = occurrences,
                    StrokeThickness = 0,
                    Width           = 20,
                    Fill            = barBrush
                });

                stringBarChart.AxisY.Add(new LiveCharts.Wpf.Axis
                {
                    Labels = yAxisValues
                });

                stringBarChart.AxisX.Add(new LiveCharts.Wpf.Axis
                {
                    LabelFormatter = value => value.ToString()
                });

                stringBarChart.DataTooltip = tooltip;
                stringBarChart.Zoom        = ZoomingOptions.Xy;
                stringBarChart.ScrollMode  = ScrollMode.XY;

                #endregion stringBarChart

                #region stringPieChart
                SeriesCollection seriesCollection = new SeriesCollection();

                foreach (KeyValuePair <string, int> keyValuePair in stringListValuePairs)
                {
                    string labelPoint(ChartPoint chartPoint) => string.Format("({0})", keyValuePair.Key);

                    if (!string.IsNullOrWhiteSpace(keyValuePair.Key))
                    {
                        SolidColorBrush pieBrush  = new SolidColorBrush(System.Windows.Media.Color.FromRgb((byte)randomColorGenerator.Next(255), (byte)randomColorGenerator.Next(255), (byte)randomColorGenerator.Next(255)));
                        PieSeries       pieSeries = new PieSeries
                        {
                            Title  = keyValuePair.Key.ToString(),
                            Values = new ChartValues <double> {
                                keyValuePair.Value
                            },
                            DataLabels      = true,
                            LabelPoint      = labelPoint,
                            StrokeThickness = 0,
                            Fill            = pieBrush
                        };
                        seriesCollection.Add(pieSeries);
                    }
                }
                stringPieChart.LegendLocation = LegendLocation.Bottom;
                stringPieChart.Series         = seriesCollection;
                stringPieChart.Zoom           = ZoomingOptions.Xy;

                #endregion stringPieChart
            }
        }
示例#18
0
        //
        public void LineChartConfigure()
        {
            var lineTempTS1Series = new LineSeries();

            lineTempTS1Series.Title  = "Nhiệt độ TS3";
            lineTempTS1Series.Values = new ChartValues <ObservableValue>
            {
                new ObservableValue(0)
            };
            lineTempTS1Series.PointGeometrySize = 6;

            var lineTempTS2Series = new LineSeries();

            lineTempTS2Series.Title  = "Nhiệt độ TS4";
            lineTempTS2Series.Values = new ChartValues <ObservableValue>
            {
                new ObservableValue(0)
            };
            lineTempTS2Series.PointGeometrySize = 6;

            var lineTempTS3Series = new LineSeries();

            lineTempTS3Series.Title  = "Nhiệt độ TS5";
            lineTempTS3Series.Values = new ChartValues <ObservableValue>
            {
                new ObservableValue(0)
            };
            lineTempTS3Series.PointGeometrySize = 6;

            var lineTempTS4Series = new LineSeries();

            lineTempTS4Series.Title  = "Nhiệt độ TS6";
            lineTempTS4Series.Values = new ChartValues <ObservableValue>
            {
                new ObservableValue(0)
            };
            lineTempTS4Series.PointGeometrySize = 6;

            var lineTempTS5Series = new LineSeries();

            lineTempTS5Series.Title  = "Nhiệt độ REF";
            lineTempTS5Series.Values = new ChartValues <ObservableValue>
            {
                new ObservableValue(0)
            };
            lineTempTS5Series.PointGeometrySize = 6;

            cartesianChart1.Series = new SeriesCollection
            {
                lineTempTS1Series,
                lineTempTS2Series,
                lineTempTS3Series,
                lineTempTS4Series,
                lineTempTS5Series,
            };
            //
            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart1.DataTooltip    = tooltip;
            cartesianChart1.LegendLocation = LegendLocation.Bottom;
        }
示例#19
0
        public LiveCharts.WinForms.CartesianChart SimulationsPerMonth()
        {
            LiveCharts.WinForms.CartesianChart cartesianChart1 = new LiveCharts.WinForms.CartesianChart();
            GenerateChartLabel("Number of Simulations" + "\n" + "Per Month ", new Point(570, 10));
            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.OnlySender
            };

            AddChartToForm(cartesianChart1, new Point(550, 72));
            //lets take the first 15 records by default;
            var records = new Dictionary <string, Dictionary <int, int> >();

            months.Keys.ToList().ForEach(m =>
            {
                data.Reports.Keys.ToList().ForEach(k =>
                {
                    if (!records.ContainsKey(k))
                    {
                        records.Add(k, new Dictionary <int, int>());
                    }
                    records[k].Add(int.Parse(m), data.Reports[k].FindAll(r => r.Creation.Month.ToString() == m).Count());
                });
            });
            cartesianChart1.Series = new SeriesCollection();

            var lbls = new string[12];

            records.Keys.ToList().ForEach(y => {
                records[y].Keys.ToList().ForEach(m => {
                    if (records[y][m] > 0)
                    {
                        lbls[m - 1] = months[m.ToString()];
                    }
                    else
                    {
                        lbls[m - 1] = "";
                    }
                });
            });
            var mapper = Mappers.Xy <int>()
                         .X(r => FindMonthByValue(records.Values.ToList(), r))
                         .Y(r => r);

            records.Keys.ToList().ForEach(y =>
                                          lbls.ToList().ForEach(m =>
            {
                int count = records[y].Values.ToList()[lbls.ToList().IndexOf(m)];
                cartesianChart1.Series.Add(new ColumnSeries
                {
                    Title         = y,
                    Configuration = mapper,
                    Values        = new ChartValues <int>()
                    {
                        count
                    }
                });
            })
                                          );

            cartesianChart1.AxisX.Add(new Axis
            {
                Title             = "Month",
                Labels            = lbls.ToList(),
                DisableAnimations = false,
                LabelsRotation    = 20,
                Separator         = new Separator
                {
                    Step = 1
                }
            });

            return(cartesianChart1);
        }
示例#20
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            string sMonth         = cmbomonth.Text;
            int    index          = cmbomonth.Items.IndexOf(sMonth);
            string mon            = null;
            string myear          = null;
            string chartsql       = null;
            string volumechartsql = null;
            int    i;

            cartesianChart1.Series.Clear();
            cartesianChart1.AxisX.Clear();
            cartesianChart1.AxisY.Clear();
            cartesianChart2.Series.Clear();
            cartesianChart2.AxisX.Clear();
            cartesianChart2.AxisY.Clear();
            cartesianChart3.Series.Clear();
            cartesianChart3.AxisX.Clear();
            cartesianChart3.AxisY.Clear();


            if (cmboyear.SelectedIndex != 0 && cmbomonth.SelectedIndex != 0)
            {
                lblchart.Text       = "Monthly '" + cmbometal.Text + "'  Sales Analysis [INR]";
                chartsql            = "select yearh,month,revenue from TBLSALESANALYSIS where yearh='" + cmboyear.Text + "' and month= '" + index + "' and Category='" + cmbometal.Text + "' group by month,yearh,revenue order by yearh,month";
                lblchartvolume.Text = "Monthly '" + cmbometal.Text + "'  Volumetric Sales Analysis [Gm]";
                volumechartsql      = "select yearh,month,Purity,Netwt from TBLVolumeAnalysis where yearh='" + cmboyear.Text + "' and month= '" + index + "' and Catagory='" + cmbometal.Text + "' and purity='" + cmbopurity.Text + "' group by month,yearh,Purity,Netwt order by yearh,month";
            }
            else
            if (cmboyear.SelectedIndex != 0 && cmbomonth.SelectedIndex == 0)
            {
                lblchart.Text       = "Yearly '" + cmbometal.Text + "'  Sales Analysis";
                chartsql            = "select yearh,month,revenue from TBLSALESANALYSIS where yearh='" + cmboyear.Text + "' and Category='" + cmbometal.Text + "' group by month,yearh,revenue order by yearh,month";
                lblchartvolume.Text = "Yearly '" + cmbometal.Text + "'  Volumetric Sales Analysis [Gm]";
                volumechartsql      = "select yearh,month,Purity,Netwt from TBLVolumeAnalysis where yearh='" + cmboyear.Text + "' and Catagory='" + cmbometal.Text + "' and purity='" + cmbopurity.Text + "' group by month,yearh,Purity,Netwt order by yearh,month";
            }
            else
            if (cmboyear.SelectedIndex == 0 && cmbomonth.SelectedIndex != 0)
            {
                lblchart.Text       = "Comparative '" + cmbometal.Text + "'  Sales Analysis";
                chartsql            = "select yearh,month,revenue from TBLSALESANALYSIS where month= '" + index + "' and Category='" + cmbometal.Text + "' group by month,yearh,revenue order by yearh,month";
                lblchartvolume.Text = "Comparative '" + cmbometal.Text + "'  Volumetric Sales Analysis [Gm]";
                volumechartsql      = "select yearh,month,Purity,Netwt from TBLVolumeAnalysis where month= '" + index + "' and Catagory='" + cmbometal.Text + "' and purity='" + cmbopurity.Text + "' group by month,yearh,Purity,Netwt order by yearh,month";
            }
            else
            {
                lblchart.Text       = "'" + cmbometal.Text + "'  Sales Analysis";
                chartsql            = "select yearh,month,revenue from TBLSALESANALYSIS where Category='" + cmbometal.Text + "' group by month,yearh,revenue order by yearh,month";
                lblchartvolume.Text = "'" + cmbometal.Text + "'  Volumetric Sales Analysis [Gm]";
                volumechartsql      = "select yearh,month,Purity,Netwt from TBLVolumeAnalysis where Catagory='" + cmbometal.Text + "' and purity='" + cmbopurity.Text + "' group by month,yearh,Purity,Netwt order by yearh,month";
            }
            //code for revenue chart
            SqlCommand    CMD = new SqlCommand(chartsql, clsConnection.Conn);
            SqlDataReader RDR = CMD.ExecuteReader();
            ColumnSeries  col = new ColumnSeries()
            {
                DataLabels = true, Values = new ChartValues <Double>(), LabelPoint = point => point.Y.ToString()
            };
            Axis ax = new Axis()
            {
                Separator = new Separator()
                {
                    Step = 1, IsEnabled = false
                }
            };

            ax.Labels = new List <string>();
            while (RDR.Read())
            {
                col.Values.Add(Convert.ToDouble(RDR["revenue"]));

                i     = Convert.ToInt32(RDR["month"].ToString());
                mon   = GetMonthName(i); //int month converted to string month name
                myear = mon + "-" + Convert.ToString(RDR["yearh"].ToString());
                ax.Labels.Add(myear);
            }

            cartesianChart1.Series.Add(col);
            cartesianChart1.AxisX.Add(ax);
            cartesianChart1.AxisY.Add(new Axis
            {
                LabelFormatter = value => value.ToString(),
                Separator      = new Separator()
            });
            RDR.Close();
            CMD.Dispose();
            //end code for revenue chart

            //code for volume chart
            SqlCommand    CMD2 = new SqlCommand(volumechartsql, clsConnection.Conn);
            SqlDataReader RDR2 = CMD2.ExecuteReader();
            ColumnSeries  col2 = new ColumnSeries()
            {
                DataLabels = true, Values = new ChartValues <Double>(), LabelPoint = point => point.Y.ToString()
            };
            Axis ax2 = new Axis()
            {
                Separator = new Separator()
                {
                    Step = 1, IsEnabled = false
                }
            };

            ax2.Labels = new List <string>();
            while (RDR2.Read())
            {
                col2.Values.Add(Convert.ToDouble(RDR2["NetWt"]));

                i     = Convert.ToInt32(RDR2["month"].ToString());
                mon   = GetMonthName(i); //int month converted to string month name
                myear = mon + "-" + Convert.ToString(RDR2["yearh"].ToString());
                ax2.Labels.Add(myear);
            }

            cartesianChart2.Series.Add(col2);
            cartesianChart2.AxisX.Add(ax2);
            cartesianChart2.AxisY.Add(new Axis
            {
                LabelFormatter = value => value.ToString(),
                Separator      = new Separator()
            });

            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart1.DataTooltip = tooltip;
            CMD.Dispose();
            CMD2.Dispose();
            //end code for volume chart
        }
示例#21
0
        private void DataBase_Load(object sender, EventArgs e)
        {
            //labelBasicStacked.Visible = false;
            //labelLineChart.Visible = false;
            //labelDoughNutChart.Visible = false;
            //labelRowChart.Visible = false;
            //labelColumnChart.Visible = false;
            //labelPieChart.Visible = false;
            //pictureBoxColumn.Visible = false;
            //pictureBoxPie.Visible = false;
            //pictureBoxRow.Visible = false;
            //pictureBoxDoughNut.Visible = false;
            //pictureBoxStacked.Visible = false;
            //pictureBoxLine.Visible = false;
            //labelLineChart.Visible = false;
            //pictureBoxLine.Visible = false;
            pieChart1.Visible                 = false;
            pieChart2.Visible                 = true;
            cartesianChartStacked.Visible     = false;
            cartesianChart_Basic_Row.Visible  = false;
            cartesianChartLine.Visible        = false;
            cartesianChartBasicColumn.Visible = false;
            string        connectionString;
            SqlConnection connect;

            connectionString = @"Data Source=DESKTOP-TP26O9A\SQLEXPRESS;Initial Catalog=Visualization_Data;Integrated Security=True";
            connect          = new SqlConnection(connectionString);
            connect.Open();
            MessageBox.Show("Connected To DataBase 'Visualization Data'  !");

            using (SqlDataAdapter dAdapter = new SqlDataAdapter("select *from Basic_Column", connectionString))
            {
                dAdapter.Fill(dataTableBasic_Column);
            }
            using (SqlDataAdapter dAdapter = new SqlDataAdapter("select *from Basic_Row;", connectionString))
            {
                dAdapter.Fill(dataTableBasic_Row);
            }
            using (SqlDataAdapter dAdapter = new SqlDataAdapter("select *from DoughNut_Chart", connectionString))
            {
                dAdapter.Fill(dataTableDoughNut_Chart);
            }
            using (SqlDataAdapter dAdapter = new SqlDataAdapter("select *from Line_chart", connectionString))
            {
                dAdapter.Fill(dataTableLine_Chart);
            }
            using (SqlDataAdapter dAdapter = new SqlDataAdapter("select *from Pie_Chart", connectionString))
            {
                dAdapter.Fill(dataTablePie_Chart);
            }
            using (SqlDataAdapter dAdapter = new SqlDataAdapter("select *from Stacked_Chart", connectionString))
            {
                dAdapter.Fill(dataTableStacked_Chart);
            }
            connect.Close();
            //comboBox1.Items.Add(dataTableBasic_Column.TableName.ToString());
            //comboBox1.Items.Add(dataTableBasic_Row.TableName.ToString());
            //comboBox1.Items.Add(dataTableLine_Chart.TableName.ToString());
            //comboBox1.Items.Add(dataTableDoughNut_Chart.TableName.ToString());
            //comboBox1.Items.Add(dataTablePie_Chart.TableName.ToString());
            //comboBox1.Items.Add(dataTableStacked_Chart.TableName.ToString());

            //Line Chart Intialization
            cartesianChartLine.AxisX.Add(new Axis
            {
                Title  = "Month",
                Labels = new[] { "Jan", "Feb", "Mar", "Apr", "May" }
            });

            cartesianChartLine.AxisY.Add(new Axis
            {
                Title          = "Sales",
                LabelFormatter = value => value.ToString("C")
            });

            //cartesian chart stacked
            cartesianChartStacked.AxisX.Add(new Axis
            {
                Title     = "Browser",
                Labels    = new[] { "Chrome", "Mozilla", "Opera", "IE" },
                Separator = DefaultAxes.CleanSeparator
            });
            cartesianChartStacked.AxisY.Add(new Axis
            {
                Title          = "Usage",
                LabelFormatter = value => value + "MILLION"
            });
            //PieChart
            Func <ChartPoint, string> labelPoint = chartPoint =>
                                                   string.Format("{0} ({1:P})", chartPoint.Y, chartPoint.Participation);

            //DoughNut
            pieChart1.InnerRadius    = 50;
            pieChart1.LegendLocation = LegendLocation.Right;
            // column Chart intialization
            cartesianChartBasicColumn.AxisX.Add(new Axis
            {
                Title  = "Animals",
                Labels = new[] { "Cats", "Dogs", "Bears" }
            });

            cartesianChartBasicColumn.AxisY.Add(new Axis
            {
                Title          = "Value",
                LabelFormatter = value => value.ToString("N")
            });
            cartesianChartBasicColumn.LegendLocation = LegendLocation.Right;
            // Row Chart Intialization
            cartesianChart_Basic_Row.AxisY.Add(new Axis
            {
                Labels = new[] { "Aymal", "Wajahat", "Ali" }
            });
            cartesianChart_Basic_Row.AxisX.Add(new Axis
            {
                LabelFormatter = value => value.ToString("N") + "Ten"
            });
            var tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart_Basic_Row.DataTooltip = tooltip;
        }
示例#22
0
        public Form1()
        {
            InitializeComponent();

            // chart 1 = pendapatan
            OleDbConnection connection = new OleDbConnection(connParam);

            // yuk mulai implement data chart
            // buat query dan koneksikan ke db
            OleDbCommand command = new OleDbCommand("select * from qPendapatan", connection);

            connection.Open();
            OleDbDataReader reader = command.ExecuteReader();

            // fetch data
            reader.Read();

            int jan = reader.GetInt32(0);
            int feb = Convert.ToInt32(reader[1].ToString());
            int mar = Convert.ToInt32(reader[2].ToString());
            int apr = Convert.ToInt32(reader[3].ToString());
            int mei = Convert.ToInt32(reader[4].ToString());


            cartesianChart9.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Title  = "Series 1",
                    Values = new ChartValues <double> {
                        jan, feb, mar, apr, mei
                    }
                }
            };

            cartesianChart9.AxisX.Add(new Axis
            {
                Title  = "Bulan",
                Labels = new[] { "Jan", "Feb", "Mar", "Apr", "May" }
            });

            cartesianChart9.DataClick += CartesianChart9OnDataClick;

            // always call Close when done reading.
            reader.Close();

            // ================================================================================================================================================
            // lanjut chart kedua
            // lanjut chart kedua
            command = new OleDbCommand("select * from qTunai", connection);
            reader  = command.ExecuteReader();

            reader.Read();
            jan = Convert.ToInt32(reader[0].ToString());
            feb = Convert.ToInt32(reader[1].ToString());
            mar = Convert.ToInt32(reader[2].ToString());
            apr = Convert.ToInt32(reader[3].ToString());
            mei = Convert.ToInt32(reader[4].ToString());

            cartesianChart4.Series = new SeriesCollection
            {
                new ColumnSeries
                {
                    Title  = "Tunai",
                    Values = new ChartValues <double> {
                        jan, feb, mar, apr, mei
                    }
                }
            };

            // lanjut chart kedua
            command = new OleDbCommand("select * from qHutang", connection);
            reader  = command.ExecuteReader();

            reader.Read();
            jan = Convert.ToInt32(reader[0].ToString());
            feb = Convert.ToInt32(reader[1].ToString());
            mar = Convert.ToInt32(reader[2].ToString());
            apr = Convert.ToInt32(reader[3].ToString());
            mei = Convert.ToInt32(reader[4].ToString());

            //adding series will update and animate the chart automatically
            cartesianChart4.Series.Add(new ColumnSeries
            {
                Title  = "Hutang",
                Values = new ChartValues <double> {
                    jan, feb, mar, apr, mei
                }
            });

            cartesianChart4.AxisX.Add(new Axis
            {
                Title  = "Hutang",
                Labels = new[] { "Jan", "Feb", "Mar", "Apr", "Mei" }
            });

            // ================================================================================================================================================
            // lanjut chart kedua
            // lanjut chart kedua
            command = new OleDbCommand("select * from qMingguan", connection);
            reader  = command.ExecuteReader();

            reader.Read();
            int sen = Convert.ToInt32(reader[0].ToString());

            int sel = 0;

            reader.Read();
            int rab = Convert.ToInt32(reader[0].ToString());

            reader.Read();
            int kam = Convert.ToInt32(reader[0].ToString());

            reader.Read();
            int jum = Convert.ToInt32(reader[0].ToString());

            reader.Read();
            int sab = Convert.ToInt32(reader[0].ToString());

            reader.Read();
            int min = Convert.ToInt32(reader[0].ToString());

            cartesianChart8.Series = new SeriesCollection
            {
                new StackedAreaSeries
                {
                    Title  = "Senin",
                    Values = new ChartValues <DateTimePoint>
                    {
                        new DateTimePoint(new System.DateTime(2020, 5, 1), 0),
                        new DateTimePoint(new System.DateTime(2020, 5, 13), sen),
                    },
                    LineSmoothness = 0
                },
                new StackedAreaSeries
                {
                    Title  = "Selasa",
                    Values = new ChartValues <DateTimePoint>
                    {
                        new DateTimePoint(new System.DateTime(2020, 5, 1), 0),
                        new DateTimePoint(new System.DateTime(2020, 5, 13), sel),
                    },
                    LineSmoothness = 0
                },
                new StackedAreaSeries
                {
                    Title  = "Rabu",
                    Values = new ChartValues <DateTimePoint>
                    {
                        new DateTimePoint(new System.DateTime(2020, 5, 1), 0),
                        new DateTimePoint(new System.DateTime(2020, 5, 13), rab),
                    },
                    LineSmoothness = 0
                },
                new StackedAreaSeries
                {
                    Title  = "Kamis",
                    Values = new ChartValues <DateTimePoint>
                    {
                        new DateTimePoint(new System.DateTime(2020, 5, 1), 0),
                        new DateTimePoint(new System.DateTime(2020, 5, 13), kam),
                    },
                    LineSmoothness = 0
                },
                new StackedAreaSeries
                {
                    Title  = "Jumat",
                    Values = new ChartValues <DateTimePoint>
                    {
                        new DateTimePoint(new System.DateTime(2020, 5, 1), 0),
                        new DateTimePoint(new System.DateTime(2020, 5, 13), jum),
                    },
                    LineSmoothness = 0
                },
                new StackedAreaSeries
                {
                    Title  = "Sabtu",
                    Values = new ChartValues <DateTimePoint>
                    {
                        new DateTimePoint(new System.DateTime(2020, 5, 1), 0),
                        new DateTimePoint(new System.DateTime(2020, 5, 13), sab),
                    },
                    LineSmoothness = 0
                },
                new StackedAreaSeries
                {
                    Title  = "Minggu",
                    Values = new ChartValues <DateTimePoint>
                    {
                        new DateTimePoint(new System.DateTime(2020, 5, 1), 0),
                        new DateTimePoint(new System.DateTime(2020, 5, 13), min),
                    },
                    LineSmoothness = 0
                }
            };

            // ================================================================================================================================================
            // lanjut chart kedua
            // lanjut chart kedua
            command = new OleDbCommand("select * from qPelanggan", connection);
            reader  = command.ExecuteReader();

            // chart 3
            cartesianChart3.Series = new SeriesCollection
            {
                new StackedRowSeries
                {
                    Values     = new ChartValues <double> {
                    },
                    StackMode  = StackMode.Percentage,
                    DataLabels = true,
                    LabelPoint = p => p.X.ToString()
                }
            };

            while (reader.Read())
            {
                cartesianChart3.Series[0].Values.Add(Convert.ToDouble(reader[0]));
            }

            cartesianChart3.AxisY.Add(new Axis
            {
                Title  = "",
                Labels = new[] { "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu" }
            });

            var tooltip = new DefaultTooltip {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart3.DataTooltip = tooltip;

            pieChart1.InnerRadius    = 10;
            pieChart1.LegendLocation = LegendLocation.Right;

            // ================================================================================================================================================
            // lanjut chart kedua
            // lanjut chart kedua

            command = new OleDbCommand("select * from qKategori", connection);
            reader  = command.ExecuteReader();

            pieChart1.Series = new SeriesCollection {
            };

            while (reader.Read())
            {
                pieChart1.Series.Add(
                    new PieSeries
                {
                    Title  = reader[2].ToString(),
                    Values = new ChartValues <double> {
                        Convert.ToDouble(reader[1].ToString())
                    },
                    DataLabels = true
                }
                    );
            }

            // ================================================================================================================================================
            // lanjut chart kedua
            // lanjut chart kedua

            command = new OleDbCommand("select * from qGenderWanita", connection);
            reader  = command.ExecuteReader();

            cartesianChart6.Series = new SeriesCollection {
            };

            reader.Read();
            sen = Convert.ToInt32(reader[0].ToString() == null ? reader[0].ToString() : "0");
            sel = Convert.ToInt32(reader[1].ToString() == null ? reader[1].ToString() : "0");
            rab = Convert.ToInt32(reader[2].ToString() == null ? reader[2].ToString() : "0");
            kam = Convert.ToInt32(reader[3].ToString() == null ? reader[3].ToString() : "0");
            jum = Convert.ToInt32(reader[4].ToString() == null ? reader[4].ToString() : "0");
            sab = Convert.ToInt32(reader[5].ToString() == null ? reader[5].ToString() : "0");
            sab = Convert.ToInt32(reader[6].ToString() == null ? reader[6].ToString() : "0");

            cartesianChart6.Series.Add(
                new StackedRowSeries
            {
                Title  = "Female",
                Values = new ChartValues <double> {
                    sen, sel, rab, kam, jum, sab, min
                }
            }
                );

            command = new OleDbCommand("select * from qGenderPria", connection);
            reader  = command.ExecuteReader();

            cartesianChart6.Series = new SeriesCollection {
            };

            reader.Read();
            sen = Convert.ToInt32(reader[0].ToString() == null ? reader[0].ToString() : "0");
            sel = Convert.ToInt32(reader[1].ToString() == null ? reader[1].ToString() : "0");
            rab = Convert.ToInt32(reader[2].ToString() == null ? reader[2].ToString() : "0");
            kam = Convert.ToInt32(reader[3].ToString() == null ? reader[3].ToString() : "0");
            jum = Convert.ToInt32(reader[4].ToString() == null ? reader[4].ToString() : "0");
            sab = Convert.ToInt32(reader[5].ToString() == null ? reader[5].ToString() : "0");
            sab = Convert.ToInt32(reader[6].ToString() == null ? reader[6].ToString() : "0");

            cartesianChart6.Series.Add(
                new StackedRowSeries
            {
                Title  = "Male",
                Values = new ChartValues <double> {
                    sen, sel, rab, kam, jum, sab, min
                }
            }
                );

            cartesianChart6.AxisX.Add(new Axis
            {
                Title  = "Age Range",
                Labels = new[] { "0-20", "20-35", "35-45", "45-55", "55-65", "65-70", ">70" }
            });

            tooltip = new DefaultTooltip
            {
                SelectionMode = TooltipSelectionMode.SharedYValues
            };

            cartesianChart6.DataTooltip = tooltip;

            // ================================================================================================================================================
            // lanjut chart kedua
            // lanjut chart kedua
            command = new OleDbCommand("select * from qBarang", connection);
            reader  = command.ExecuteReader();

            cartesianChart2.Series = new SeriesCollection
            {
                new LineSeries
                {
                    Values = new ChartValues <double> {
                    },
                    Fill   = System.Windows.Media.Brushes.Transparent
                }
            };

            while (reader.Read())
            {
                cartesianChart2.Series[0].Values.Add(Convert.ToDouble(reader[0]));
            }

            cartesianChart2.AxisX.Add(new Axis
            {
                Labels = new[]
                {
                    "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu"
                }
            });
        }