How to Add a Vertical Line ( New X Axis ) to Exist Chart


How i add a Vertical line or a Second X Axis to a “Clustered Column” Chart ?

Can you give me an Example ?

Thank you,

Marius W.

Hi Marius,

I have observed the requirements shared by you and like to share that you need plot at-least one chart series on secondary axis in order to display that. Please try using the following sample code on your end to serve the purpose.

public static void TestMultiLinesChart()
PresentationEx pres = new PresentationEx();
SlideEx slide = pres.Slides[0];
ChartEx chart = slide.Shapes.AddChart(ChartTypeEx.ClusteredColumn, 50, 100, 400, 300);

//Inorder to enable the secondary value axis you need to assign atleast one chart series to them

ChartSeriesEx series = chart.ChartData.Series[0];

series.PlotOnSecondAxis = true;

chart.SecondValueAxis.IsVisible = true;

pres.Write(“D:\Aspose Data\TestChart.pptx”);

I am hopeful, it will work for you. If there is still an issue then please share the requirements in the form of sample chart or snapshot and I will try my best to help you further.

Many Thanks,


Thank you for the Example , but i want something like this ( Attached File ).

A Red Line in the Chart

But not set the Position with x , y !!

I want to set the Position from the Line for example with Category 1 or Category 2 or Category 3 …

Do you know what i mean ?

Thank you!

Marius W.

Hi Marius W,

I have observed the presentation file shared by you and what you have required is to draw a line that is initiated by giving the category name rather than x,y position in the chart area. I regret to share that currently the support for adding the line inside the chart area is unavailable in Aspose.Slides. An issue with ID SLIDESNET-34526 has already been created as a new feature request to further investigate an resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the feature will be available.

At present, I can offer you to solution for adding the line separately over the chart by specifying the x,y coordinates. This is the only option that is available at the moment. Please visit this documentation link for your kind reference to see how to manage lines in slide.

We are sorry for your inconvenience,

Hi Marius W,

I suggest you to please
try using below sample code on your end in order to add line or other
autoshapes along with chart. You can try exploring the feature IChart.UserShape to serve the purpose on your end.

//add line into chart with relative coordinates (80,0) and height 100
chart.UserShapes.Shapes.AddAutoShape(ShapeType.Line, 80, 0, 0, 100);

I hope the shared information will be helpful.

Many Thanks,

The issues you have found earlier (filed as SLIDESNET-34526) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.