We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Move labels for negative values on top of the chart

Hi Team,

Could you tell me if there is a way to move all labels above the chart bars (column chart) - by default when label position is set to “Outside End” labels will be shown below the bars in the chart - please see attached image.

You can move them manually - is there a way to move labels with Aspose, to get the result as on the attached image?


2_NewPositions.jpg (25.7 KB)
1_LabelsDefault.jpg (20.9 KB)


I have observed your requirements and like to share that you can set the label position as fraction of chart width and height. You can set Label’s X and Y position between -1 to 1. The value 0,0 will correspond to default label position. Please observe the following sample code and use it as per your convenience on your end.

public static void TestLabelPosition()
    Presentation pres = new Presentation();

    IChart chart =pres.Slides[0].Shapes.AddChart(ChartType.ClusteredColumn,20,20,400,400);
    chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowValue = true;
    //Top right position
    chart.ChartData.Series[0].DataPoints[0].Label.X =-1;
    chart.ChartData.Series[0].DataPoints[0].Label.Y = -1;

    //Actual Label position on desired label
    chart.ChartData.Series[0].DataPoints[1].Label.X = 0;
    chart.ChartData.Series[0].DataPoints[1].Label.Y = 0;

    //Bottom Right
    chart.ChartData.Series[0].DataPoints[2].Label.X = 1;
    chart.ChartData.Series[0].DataPoints[2].Label.Y = 1;

    pres.Save(@"C:\Aspose Data\LabelPostions2.pptx", Aspose.Slides.Export.SaveFormat.Pptx);


Many Thanks,