Hello,
Thanks for your feedback!
Here I attached the code I tested, and the file generated. In the screenshot, you can see that the color of the chart line and the trend line have changed.
- Code: Select all
Presentation ppt = new Presentation();
RectangleF rect1 = new RectangleF(40, 100, 900, 320);
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.Line, rect1, false);
chart.Line.FillType = FillFormatType.Solid;
chart.Line.SolidFillColor.Color = Color.Black;
//Data for series
Double[] Series1 = new Double[] { 7.7, 8.9, 1.0, 2.4 };
Double[] Series2 = new Double[] { 15.2, 5.3, 6.7, 8 };
//Set series text
chart.ChartData[0, 1].Text = "Series1";
chart.ChartData[0, 2].Text = "Series2";
//Set category text
chart.ChartData[1, 0].Text = "Category 1";
chart.ChartData[2, 0].Text = "Category 2";
chart.ChartData[3, 0].Text = "Category 3";
chart.ChartData[4, 0].Text = "Category 4";
//Fill data for chart
for (Int32 i = 0; i < Series1.Length; ++i)
{
chart.ChartData[i + 1, 1].Value = Series1[i];
chart.ChartData[i + 1, 2].Value = Series2[i];
}
//Set series label
chart.Series.SeriesLabel = chart.ChartData["B1", "C1"];
//Set category label
chart.Categories.CategoryLabels = chart.ChartData["A2", "A5"];
//Set values for series
chart.Series[0].Values = chart.ChartData["B2", "B5"];
chart.Series[1].Values = chart.ChartData["C2", "C5"];
ITrendlines it = chart.Series[0].AddTrendLine(TrendlinesType.Linear);
it.displayEquation = false;
it.displayRSquaredValue = false;
it.type = TrendlinesType.Polynomial;
it.polynomialTrendlineOrder = 6;
it.Line.FillType = FillFormatType.Solid;
it.Line.SolidFillColor.KnownColor = KnownColors.Green;
String result = "CreateLineMarkersChart_result.pptx";
//Save the document
ppt.SaveToFile(result, FileFormat.Pptx2010);
color.png
Could you please provide us with your whole testing code, your target framework(E.g. .Net framework 4.8.0), your system information (E.g. Win7, 64 bit) and region setting (E.g. China, Chinese) for reference? Thanks in advance.
Sincerely,
Marcia
E-iceblue support team
Login to view the files attached to this post.