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

Free Support Forum - aspose.com

Negative Value Slide need All Text on Bottom not Top

I have Charts that have negative Values.
I need to have Categories at the bottom of the Graph
Need Labels / Values of Each bar right under each bar.
Also the Series Legend that is to the right of the Graph has to be Under the graph.
I am not sure if Title Can Go Above the Graph, not inside of it. (maybe need no Title but a cell above Graph ? )

Also is there a picture of all the available Styles (There are 4 Chart Styles,
do I have to try every single 1 to see what it looks like ? )

Code:
String path = Application.StartupPath;

        System.Data.DataTable table = new System.Data.DataTable();
        table.Columns.Add("Label", typeof(string));
        table.Columns.Add("OrgNorm", typeof(decimal));
        table.Columns.Add("Norm", typeof(decimal));
        table.Columns.Add("Cnt", typeof(int));

        table.Rows.Add(@"My Category 1", -4.10, -3.62, 5);
        table.Rows.Add(@"My Category 2", -4.35, -4.61, 5);
        table.Rows.Add(@"My Other Category 3", -4.15, -3.78, 5);

        Presentation pres = new Presentation();
        ISlide sld = pres.Slides[0];

        // Add chart with default data
        IChart chart = sld.Shapes.AddChart(ChartType.ClusteredColumn, 50, 50, 400, 200);
        chart.Style = StyleType.Style1;

        // Setting chart Title
        // Chart.ChartTitle.TextFrameForOverriding.Text = "Sample Title";
        chart.ChartTitle.AddTextFrameForOverriding("Growth Curve of Stuff");
        chart.ChartTitle.TextFrameForOverriding.TextFrameFormat.CenterText = NullableBool.True;
        chart.ChartTitle.Height = 20;
        //chart.ChartTitle.Y = -200;
        //chart.ChartTitle.X = -0;
        chart.HasTitle = true;


        // Set first series to Show Values
        chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowValue = true;

        // Setting the index of chart data sheet
        int defaultWorksheetIndex = 0;

        // Getting the chart data worksheet
        IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;

        // Delete default generated series and categories
        chart.ChartData.Series.Clear();
        chart.ChartData.Categories.Clear();
        int s = chart.ChartData.Series.Count;
        s = chart.ChartData.Categories.Count;


        // Adding new series
        chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 1, "My Growth"), chart.Type);
        chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 2, "Normal Growth"), chart.Type);


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



        for (int i = 0; i < table.Rows.Count; i++)
        {
            DataRow row = table.Rows[i];
            var x = chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, i + 1, 0, row[0]));


            // Take first chart series

            series = chart.ChartData.Series[0];
            series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, i + 1, 1, row[1]));
            series.Format.Fill.FillType = FillType.Solid;
            series.Format.Fill.SolidFillColor.Color = Color.Blue;
            series.InvertIfNegative = false;

            series = chart.ChartData.Series[1];
            series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, i + 1, 2, row[2]));
            series.Format.Fill.FillType = FillType.Solid;
            series.Format.Fill.SolidFillColor.Color = Color.Black;
            series.InvertIfNegative = false;



        }


        series = chart.ChartData.Series[0];
        series.Format.Fill.FillType = FillType.Solid;
        series.Format.Fill.SolidFillColor.Color = Color.Cyan;

        series = chart.ChartData.Series[1];
        series.Format.Fill.FillType = FillType.Solid;
        series.Format.Fill.SolidFillColor.Color = Color.Black;

        // Adding new categories
        ////chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 1, 0, "Caetegoty 1"));
        ////chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 2, 0, "Caetegoty 2"));
        ////chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 3, 0, "Caetegoty 3"));



        // Now populating series data

        ////series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 1, 1, 20));
        ////series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 2, 1, 50));
        ////series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 3, 1, 30));

        // Setting fill color for series
        ////series.Format.Fill.FillType = FillType.Solid;
        ////series.Format.Fill.SolidFillColor.Color = Color.Red;


        // Take second chart series
        //series = chart.ChartData.Series[1];

        // Now populating series data
        ////series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 1, 2, 30));
        ////series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 2, 2, 10));
        ////series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 3, 2, 60));

        // Setting fill color for series
        //series.Format.Fill.FillType = FillType.Solid;
        //series.Format.Fill.SolidFillColor.Color = Color.Green;


        //=================
        // First label will be show Category name
        ////IDataLabel lbl = series.DataPoints[0].Label;
        ////lbl.DataLabelFormat.ShowCategoryName = true;
        ////lbl = series.DataPoints[1].Label;
        ////lbl.DataLabelFormat.ShowSeriesName = true;

        // Show value for third label
        ////lbl = series.DataPoints[2].Label;
        ////lbl.DataLabelFormat.ShowValue = true;
        ////lbl.DataLabelFormat.ShowSeriesName = true;
        ////lbl.DataLabelFormat.Separator = "/";



        chart.Axes.HorizontalAxis.CategoryAxisType = CategoryAxisType.Text;
        chart.Axes.HorizontalAxis.Position = AxisPositionType.Bottom;

       // chart.Axes.SecondaryHorizontalAxis.Position = AxisPositionType.Bottom;

        //chart.Axes.SeriesAxis.Position = AxisPositionType.Bottom;

        pres.Save(path + @"\Test.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

@EthernetIp

Can you please provide the desired output presentation that you want to generate. Please also share the working sample code that you have adopted along with source presentation if any. I will try to generate the desired presentation by continuing your example.