Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents from any .NET(C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Thu May 09, 2019 4:18 am

Hi,

I need to change GapWidth for one series in a combination chart. I have 7 Series (6 series type Line and 1 series type ColumnClustered) and I will like to change GapWidth for the series ColumnClustered, but not have this option. I try setting GapWidth and Overlap in the Chart, but not worked. Thanks.
Here's my code:
Code: Select all
 
          //insert chart
            RectangleF rect = new RectangleF(convCM2Points(0.75f), convCM2Points(7f), this.ppt.SlideSize.Size.Width - (convCM2Points(0.75f)+10), convCM2Points(6.58f));
            IChart chart = this.ppt.Slides[0].Shapes.AppendChart(Spire.Presentation.Charts.ChartType.Line, rect);
            chart.Name = "chartPracas";
            //add chart Title
            chart.ChartTitle.TextProperties.Text = _titulo;
            chart.ChartTitle.TextProperties.IsCentered = true;
            chart.ChartTitle.Height = 30;
            chart.HasTitle = false;

            DataTable dtXLS = this.dsDados.Tables["tbFatos"];
            int nroRec = InitChartData(chart, dtXLS);

            chart.Series.SeriesLabel = chart.ChartData["B1", ((char)(64 + (dtXLS.Columns.Count - 4) + 1)).ToString() + "1"] ;
            chart.Categories.CategoryLabels = chart.ChartData["A2", "A" + (nroRec + 1).ToString()];
            // Criando as Series
            int iSerie = 0;
            var corSerie = Util.Emissora.ToColor();
            var legendaSerie = Util.Emissora.ToLegenda();
            List<EmissoraLegenda> lstEmissora = Util.Emissora;
           
            chart.OverLap = 0;
            chart.GapWidth = 15;
           
            foreach (Spire.Presentation.Charts.CellRange sEmis in chart.Series.SeriesLabel)
            {
                string sLetra = ((char)(66 + iSerie)).ToString();
                string sEmissora = sEmis.Text;
                var posIni = ((char)(66 + iSerie)).ToString() + "2";
                var posFim = ((char)(66 + iSerie)).ToString() + (nroRec + 1).ToString();
                if (sEmis.Text.IndexOf("_") > -1)
                    sEmissora = sEmis.Text.Substring(0, sEmis.Text.IndexOf("_"));
                var cor = lstEmissora.Find(x => x.Canal.ToLower().Contains(sEmissora.ToLower()) || x.Legenda.ToLower().Contains(sEmissora.ToLower())) != null ? lstEmissora.Find(x => x.Canal.ToLower().Contains(sEmissora.ToLower()) || x.Legenda.ToLower().Contains(sEmissora.ToLower())).Cor : new CorRGB();
                chart.Series[iSerie].Values = chart.ChartData[posIni, posFim];
                chart.Series[iSerie].Fill.FillType = FillFormatType.Solid;
                chart.Series[iSerie].Fill.SolidColor.Color = (sEmissora.ToLower() != "shr" ? cor.FromArg : Color.FromArgb(150, 252,213,181));
                chart.Series[iSerie].Line.FillType = FillFormatType.Solid;
                chart.Series[iSerie].Line.FillFormat.SolidFillColor.Color = (sEmissora.ToLower() != "shr" ? cor.FromArg : Color.FromArgb(150, 252, 213, 181));
                chart.Series[iSerie].Type = (sEmissora.ToLower() != "shr" ? ChartType.Line : ChartType.ColumnClustered);
                chart.Series[iSerie].UseSecondAxis = (sEmissora.ToLower() == "shr");
                chart.Series[iSerie].DataLabels.LabelValueVisible = true;
                chart.Series[iSerie].DataLabels.NumberFormat = (sEmissora.ToLower() != "shr" ? "#" : "#\\%");
                chart.Series[iSerie].DataLabels.Position = (sEmissora.ToLower() != "shr" ? ChartDataLabelPosition.Top : ChartDataLabelPosition.OutsideEnd);

                chart.Series[iSerie].DataLabels.HasDataSource = false;
                //set the font
                chart.Series[iSerie].DataLabels.TextProperties.Paragraphs[0].DefaultCharacterProperties.LatinFont = new TextFont("Arial");
                chart.Series[iSerie].DataLabels.TextProperties.Paragraphs[0].DefaultCharacterProperties.IsBold = (sEmissora.ToLower() != "shr" ? TriState.False : TriState.True);
                //set the font size
                chart.Series[iSerie].DataLabels.TextProperties.Paragraphs[0].DefaultCharacterProperties.FontHeight = 9;
                //set the font color
                chart.Series[iSerie].DataLabels.TextProperties.Paragraphs[0].DefaultCharacterProperties.Fill.FillType = FillFormatType.Solid;
                chart.Series[iSerie].DataLabels.TextProperties.Paragraphs[0].DefaultCharacterProperties.Fill.SolidColor.Color = (sEmissora.ToLower() != "shr" ? cor.FromArg : Color.Orange);
                chart.Series[iSerie].IsSmooth = TriState.True;
                chart.Series[iSerie].Line.Width = 1.5f;
                if (sEmissora.ToLower() == "globo")
                {
                    chart.Series[iSerie].Line.Width = 2.5f;
                    chart.Series[iSerie].DataLabels.TextProperties.Paragraphs[0].DefaultCharacterProperties.IsBold = TriState.True;
                }

                iSerie++;
            }


psoares
 
Posts: 3
Joined: Wed Nov 21, 2018 2:45 am

Thu May 09, 2019 7:27 am

Hello,

Thank you for contacting.
After an initial test with our latest Spire.Presentation Pack Hotfix Version:4.4.10, I found that it works well when setting the GapWidth. Thus, I suggest you try again with the latest version. If your issue still occurs after trying, please provide your runnable application as well as more details about your error. You could upload your application via OnceDrive or Dropbox and then share us with the link to download, or you also can send the link to our email(support@e-iceblue.com).

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1041
Joined: Wed Apr 25, 2018 3:20 am

Thu May 09, 2019 11:19 pm

Thank you for your answer.
I'm using Free Spire.Office for .NET (Spire.Presentation.dll 4.2.6, I did download in this week). :( :( :lol:
I will wait for the next update the Free Version.

Would you have a forecast for when the Free version will be updated?

Thanks.
Your product is very useful.

psoares
 
Posts: 3
Joined: Wed Nov 21, 2018 2:45 am

Fri May 10, 2019 2:44 am

Hello,

Thanks for your feedback.
Sorry I can’t provide a forecast for when the Free version will be updated at this moment, we only upgrade the Free version irregularly. However, when testing with the Free Spire.Office Version:4.3 (Spire.Presentation.dll 4.2.6), I still didn't encounter any issue while setting the GapWidth. To help further look into your issue, please share us with your runnable application as well as more details about your error. Thanks in advance.
Besides, we are willing to provide a temporary license (one month free) of Spire.Office to help you evaluate our paid version better and remove the warning message. If interested, please contact our sales them (sales@e-iceblue.com) to get it.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1041
Joined: Wed Apr 25, 2018 3:20 am

Thu May 16, 2019 9:49 am

Hello,

Greetings from E-iceblue.
Could you please let us know how is the issue going? Thanks in advance for your valuable feedback and time.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1041
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.Presentation