Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Wed Nov 12, 2014 9:52 am

Hi

I am trying your product to see if it will suit what I need to achieve. One thing I want to do is have a chart with no grid lines and no tick marks. The chart is a basic ClusterColumn chart. I have read your help and explored all the properties and believe I am using the right properties, but none of these will actually remove the grid lines or tick marks from the chart. I am not sure if this is a bug or I am not looking in the right place.

Here is a whole lot of things I have tried but none have worked. Please point me in the right direction. Thanks so much.


chart.PrimaryValueAxis.MajorGridTextLines.Style = TextLineStyle.None;
chart.PrimaryCategoryAxis.MajorGridTextLines.Style = TextLineStyle.None;
chart.SecondaryValueAxis.MajorGridTextLines.Style = TextLineStyle.None;
chart.SecondaryCategoryAxis.MajorGridTextLines.Style = TextLineStyle.None;

chart.PrimaryValueAxis.MinorGridLines.Style = TextLineStyle.None;
chart.PrimaryCategoryAxis.MinorGridLines.Style = TextLineStyle.None;
chart.SecondaryValueAxis.MinorGridLines.Style = TextLineStyle.None;
chart.SecondaryCategoryAxis.MinorGridLines.Style = TextLineStyle.None;

chart.GridLine.Style = TextLineStyle.None;
chart.PlotArea.Line.Style = TextLineStyle.None;

chart.PrimaryValueAxis.MajorTickMark = TickMarkType.TickMarkNone;
chart.PrimaryCategoryAxis.MinorTickMark = TickMarkType.TickMarkNone;



Matt

mattgreen
 
Posts: 1
Joined: Mon Nov 03, 2014 1:35 pm

Thu Nov 13, 2014 8:57 am

Hello,

Thanks for your inquiry.
It seems that you were trying the free version. Please upgrade to the trial edition(Spire.Presentation Pack Hotfix Version:2.1.17).
The following codes are for your reference. In additinal, currently our product doesn't support the feature to set the font on axis and set the series border, I have transferred the requirement to our Dev team, once there are any progress, we will let you know.
Code: Select all
        Presentation pres = new Presentation();
        RectangleF rect1 = new RectangleF(0, 0, 500, 300);
        IChart chart = pres.Slides[0].Shapes.AppendChart(ChartType.ColumnClustered, rect1, false);
        //set data
        chart.ChartData["B1"].Text = "Series 1";
        chart.ChartData["C1"].Text = "Series 2";
        chart.ChartData["A2"].Text = "Category 1";
        chart.ChartData["A3"].Text = "Category 2";
        chart.ChartData["A4"].Text = "Category 3";
        chart.ChartData["A5"].Text = "Category 4";
        chart.ChartData["B2"].NumberValue = 1000000;
        chart.ChartData["B3"].NumberValue = 2000000;
        chart.ChartData["B4"].NumberValue = 3000000;
        chart.ChartData["B5"].NumberValue = 4000000;
        chart.ChartData["C2"].NumberValue = 5000000;
        chart.ChartData["C3"].NumberValue = 6000000;
        chart.ChartData["C4"].NumberValue = 7000000;
        chart.ChartData["C5"].NumberValue = 8000000;
        chart.Categories.CategoryLabels=chart.ChartData["A2","A5"];
        chart.Series.SeriesLabel = chart.ChartData["B1", "C1"];
        chart.Series[0].Values = chart.ChartData["B2", "B5"];
        chart.Series[0].Fill.FillType = FillFormatType.Solid;
        //set transparency on series fill
        chart.Series[0].Fill.SolidColor.Color = Color.FromArgb(100, Color.Red);
        chart.Series[1].Values = chart.ChartData["C2", "C5"];
        //remove grid line
        chart.PrimaryValueAxis.MajorGridTextLines.FillType = FillFormatType.None;
        //format number
        chart.PrimaryValueAxis.NumberFormat = "### ### ### ##0";
        ////add major tick of Y axis
        //chart.PrimaryValueAxis.MajorTickMark = TickMarkType.TickMarkOutside;
        pres.SaveToFile( "CreateClusterColumnChart.pptx", FileFormat.Pptx2007);

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri Nov 14, 2014 7:14 am

Hello Matt,

By investigating, we found that there are methods to set the font and border color. Here are the codes for your reference.
Code: Select all
//set font size
chart.PrimaryCategoryAxis.TextProperties.Paragraphs[0].DefaultCharacterProperties.FontHeight = 9; chart.PrimaryValueAxis.TextProperties.Paragraphs[0].DefaultCharacterProperties.FontHeight = 9;
//set border
chart.Series[0].Line.FillType = FillFormatType.Solid;
chart.Series[0].Line.SolidFillColor.Color = Color.Yellow;

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Presentation