Example #1
0
        private void BtnDoubleAxisBar_Click(object sender, EventArgs e)
        {
            var chart = new DoubleAxisBarChart
            {
                FormatBarValue = "{0}%",
                Width          = pictureBox1.Width,
                Height         = pictureBox1.Height,
                Categories     = new[] { "Product A", "Product B", "Product C", "Product D", "Product E", "Product F" },
                FirstDataSet   = new DoubleAxisBarSeries
                {
                    Label = "Income",
                    Color = Color.LightBlue,
                    Data  = new[] { 5f, 10f, 5f, 1f, 12f, 7f },
                },
                SecondDataSet = new DoubleAxisBarSeries
                {
                    Label = "Outcome",
                    Color = Color.LightCoral,
                    Data  = new[] { 15f, 10f, 15f, 8f, 2f, 14f },
                }
            };

            pictureBox1.Image = chart.CreateImage();
            pictureBox1.Image.Save(@"D:\GitHub\SimpleImageCharts\screenshots\DoubleAxisBarChart.jpg");
        }
        public static DoubleAxisBarChart CreateChart(Size size)
        {
            var chart = new DoubleAxisBarChart
            {
                FormatBarValue = "{0}%",
                Size           = size,
                Categories     = new[] { "Product A", "Product B", "Product C", "Product D", "Product E", "Product F" },
                FirstDataSet   = new DoubleAxisBarSeries
                {
                    Label = "Income",
                    Color = Color.LightBlue,
                    Data  = new[] { 5f, 10f, 5f, 1f, 12f, 7f },
                },
                SecondDataSet = new DoubleAxisBarSeries
                {
                    Label = "Outcome",
                    Color = Color.LightCoral,
                    Data  = new[] { 15f, 10f, 15f, 8f, 2f, 14f },
                }
            };

            return(chart);
        }