如何在我的图表栏之间获得空间?

时间:2014-11-04 18:47:40

标签: c# charts

http://i.stack.imgur.com/TzY6q.png

我使用c#在Windows窗体应用程序中构建此图表,但我找不到分隔图表条形的方法。正如你在图像中看到的那样,它们是粘合的#34;。 任何人都可以帮助我吗?我做错了什么?请查看链接以查看我的实际图表。

谢谢

我的代码:

    private void InitChart()
    {
        if (AvaliacaoFisica != null)
        {
            // Data arrays.
            string[] seriesArray = { "Ombros", "Peito", "Brç Dir", "Brç Esq", "Cintura", "Abs", "Anca", "Coxa Drt", "Coxa Esq" };//"Altura", "Peso", "Idade",
            double[] pointsArray = { 
                                     double.Parse(AvaliacaoFisica.PerOmbros.ToString(), System.Globalization.CultureInfo.InvariantCulture), double.Parse(AvaliacaoFisica.PerPeito.ToString(), System.Globalization.CultureInfo.InvariantCulture),  double.Parse(AvaliacaoFisica.PerBracoDir.ToString(), System.Globalization.CultureInfo.InvariantCulture),
                                     double.Parse(AvaliacaoFisica.PerBracoEsq.ToString(), System.Globalization.CultureInfo.InvariantCulture), double.Parse(AvaliacaoFisica.PerCintura.ToString(), System.Globalization.CultureInfo.InvariantCulture), double.Parse(AvaliacaoFisica.PerAbs.ToString(), System.Globalization.CultureInfo.InvariantCulture),
                                     double.Parse(AvaliacaoFisica.PerAnca.ToString(), System.Globalization.CultureInfo.InvariantCulture), double.Parse(AvaliacaoFisica.PerCoxaEsq.ToString(), System.Globalization.CultureInfo.InvariantCulture), double.Parse(AvaliacaoFisica.PerCoxaDrt.ToString(), System.Globalization.CultureInfo.InvariantCulture)
                                   };//double.Parse(AvaliacaoFisica.Altura.ToString(), System.Globalization.CultureInfo.InvariantCulture) * 100, double.Parse(AvaliacaoFisica.Peso.ToString(), System.Globalization.CultureInfo.InvariantCulture), dcsDB.GetInt(AvaliacaoFisica.Idade),

            // Set palette.
            this.chart1.Palette = ChartColorPalette.Fire;   //Colors group for chart
            this.chart1.BackColor = Color.Transparent;      //Background Color
            this.chart1.ForeColor = Color.White;

            // Set title.
            this.chart1.Titles.Add(
                new Title(
                    "Estatísticas - " + AvaliacaoFisica.DtAvaliacao.ToShortDateString(), //Title String
                    Docking.Top,                                                        //Location
                    new Font("Verdana", 13f, FontStyle.Bold),                           //Font Type
                    Color.White                                                         //Font Color
                )
            );

            chart1.Legends.Add("Legenda");

            chart1.ChartAreas[0].AxisX.TitleForeColor = Color.White;    //Cor da legenda do eixo x
            chart1.ChartAreas[0].AxisX.Title = "TESTE X";               //título da legenda do eixo do x
            chart1.ChartAreas[0].AxisY.TitleForeColor = Color.White;    //Cor da legenda do eixo y
            chart1.ChartAreas[0].AxisY.Title = "TESTE Y";               //título da legenda do eixo y

            //chart1.ChartAreas[0].AxisX.Interval = 5;                    //Definir intervalo de numeração no eixo do x


            // Add series.
            for (int i = 0; i < seriesArray.Length; i++)
            {
                // Add series.
                Series series = this.chart1.Series.Add(seriesArray[i]);

                //Legenda das barras do gráfico com nome e valor
                series.Label = seriesArray[i].ToString() + " " + pointsArray[i].ToString();        //Texto
                series.LabelToolTip = seriesArray[i].ToString() + " " + pointsArray[i].ToString(); //ToolTip
                series.LegendToolTip = pointsArray[i].ToString();                                   //ToolTip Legenda
                series.LabelBackColor = Color.YellowGreen;                                          //Cor de fundo do texto

                // Add point.
                series.Points.Add(pointsArray[i]);
                series.AxisLabel = " OI ";
            }
        }
    }

0 个答案:

没有答案