public Chart GenerateChart(string title) { Chart chart1 = new Chart(); Title title1 = GenerateTitle(title); PlotArea plotArea1 = new PlotArea(); Layout layout2 = GeneratePlotAreaLayout(); BarChart barChart1 = new BarChart(); BarDirection barDirection1 = new BarDirection() { Val = BarDirectionValues.Column }; BarGrouping barGrouping1 = new BarGrouping() { Val = BarGroupingValues.Clustered }; AxisId axisId1 = new AxisId() { Val = (UInt32Value)92179456U }; AxisId axisId2 = new AxisId() { Val = (UInt32Value)92463872U }; barChart1.Append(barDirection1); barChart1.Append(barGrouping1); barChart1.Append(axisId1); barChart1.Append(axisId2); CategoryAxis categoryAxis1 = GenerateCategoryAxis(axisId1, AxisPositionValues.Bottom, categoryAxisFormat, axisId2); ValueAxis valueAxis1 = GenerateValueAxis(axisId2, AxisPositionValues.Left, valueAxisFormat, axisId1); ShapeProperties shapeProperties1 = new ShapeProperties(); A::NoFill noFill3 = new A::NoFill(); A::Outline outline8 = new A::Outline() { Width = 25400 }; A::NoFill noFill4 = new A::NoFill(); outline8.Append(noFill4); shapeProperties1.Append(noFill3); shapeProperties1.Append(outline8); plotArea1.Append(layout2); plotArea1.Append(barChart1); plotArea1.Append(categoryAxis1); plotArea1.Append(valueAxis1); plotArea1.Append(shapeProperties1); Legend legend1 = GenerateLegend(LegendPositionValues.Right); PlotVisibleOnly plotVisibleOnly1 = new PlotVisibleOnly() { Val = true }; DisplayBlanksAs displayBlanksAs1 = new DisplayBlanksAs() { Val = DisplayBlanksAsValues.Gap }; chart1.Append(title1); chart1.Append(plotArea1); chart1.Append(legend1); chart1.Append(plotVisibleOnly1); chart1.Append(displayBlanksAs1); return chart1; }
public Chart GenerateChart(string title, List<AssetWeighting> data) { string[] pointNames = data.Select(p => p.AssetClass).ToArray(); double[] values = data.Select(v => v.Weighting ?? 0).ToArray(); Chart chart1 = new Chart(); Title title1 = GenerateTitle(title, 1200); PlotArea plotArea1 = new PlotArea(); Layout layout2 = GeneratePlotAreaLayout(); LayoutTarget layoutTarget1 = new LayoutTarget() { Val = LayoutTargetValues.Inner }; LeftMode leftMode2 = new LeftMode() { Val = LayoutModeValues.Edge }; TopMode topMode2 = new TopMode() { Val = LayoutModeValues.Edge }; Left left2 = new Left() { Val = 0.10397108399455671D }; Top top2 = new Top() { Val = 0.13928263342174291D }; Width width1 = new Width() { Val = 0.88016518444392156D }; Height height1 = new Height() { Val = 0.59349350997070749D }; BarChart barChart1 = new BarChart(); BarDirection barDirection1 = new BarDirection() { Val = BarDirectionValues.Column }; BarGrouping barGrouping1 = new BarGrouping() { Val = BarGroupingValues.Clustered }; BarChartSeries barChartSeries1 = GenerateBarChartSeries(seriesName, pointNames, values, colourHex, valueFormat); AxisId axisId1 = new AxisId() { Val = (UInt32Value)97045504U }; AxisId axisId2 = new AxisId() { Val = (UInt32Value)97055488U }; barChart1.Append(barDirection1); barChart1.Append(barGrouping1); barChart1.Append(barChartSeries1); barChart1.Append(axisId1); barChart1.Append(axisId2); ValueAxis valueAxis1 = GenerateValueAxis(axisId2, AxisPositionValues.Left, valueAxisFormat, axisId1); CategoryAxis categoryAxis1 = GenerateCategoryAxis(axisId1, AxisPositionValues.Bottom, categoryAxisFormat, axisId2); ShapeProperties shapeProperties1 = new ShapeProperties(); A::NoFill noFill3 = new A::NoFill(); A::Outline outline6 = new A::Outline() { Width = 25400 }; A::NoFill noFill4 = new A::NoFill(); outline6.Append(noFill4); shapeProperties1.Append(noFill3); shapeProperties1.Append(outline6); plotArea1.Append(layout2); plotArea1.Append(barChart1); plotArea1.Append(categoryAxis1); plotArea1.Append(valueAxis1); plotArea1.Append(shapeProperties1); PlotVisibleOnly plotVisibleOnly1 = new PlotVisibleOnly() { Val = true }; DisplayBlanksAs displayBlanksAs1 = new DisplayBlanksAs() { Val = DisplayBlanksAsValues.Gap }; chart1.Append(title1); chart1.Append(plotArea1); chart1.Append(plotVisibleOnly1); chart1.Append(displayBlanksAs1); return chart1; }