Hi
Has anyone dot a demo in c# for this kind of chart ?
Thanks
Yosi Sender
Workbook book = new Workbook();
book.LoadFromFile("c.xlsx");
Worksheet sheet = book.Worksheets[0];
Chart chart = sheet.Charts.Add();
chart.DataRange = sheet.Range["A1:M4"];
chart.SeriesDataFromRange = true;
chart.LeftColumn = 2;
chart.TopRow = 5;
chart.RightColumn = 15;
chart.BottomRow = 26;
// chart title
chart.ChartTitle = "test";
chart.ChartTitleArea.IsBold = true;
chart.ChartTitleArea.Size = 12;
chart.PrimaryCategoryAxis.CategoryType = CategoryType.Category;
//Primary value Axis
chart.PrimaryValueAxis.HasMajorGridLines = false;
chart.PrimaryValueAxis.MinValue = 180;
chart.PrimaryValueAxis.MaxValue = 500;
//Secondary value Axis
chart.SecondaryValueAxis.MaxValue = 1.5;
chart.SecondaryValueAxis.MinValue = 0.5;
chart.SecondaryValueAxis.MinorUnit = 0.1;
chart.SecondaryValueAxis.MajorUnit = 0.5;
chart.SecondaryCategoryAxis.IsMaxCross = true;
var cs1 = (ChartSerie)chart.Series[0];
cs1.SerieType = ExcelChartType.Line;
cs1.Format.Options.IsVaryColor = false;
cs1.DataPoints.DefaultDataPoint.DataLabels.HasValue = true;
cs1.DataPoints.DefaultDataPoint.DataLabels.Position = DataLabelPositionType.Above;
cs1.DataFormat.MarkerStyle = ChartMarkerType.None;
cs1.DataFormat.LineProperties.Color = System.Drawing.Color.DarkRed;
var cs2 = (ChartSerie)chart.Series[1];
cs2.SerieType = ExcelChartType.ColumnStacked;
cs2.Format.Options.IsVaryColor = false;
cs2.DataPoints.DefaultDataPoint.DataLabels.HasValue = true;
cs2.DataFormat.ForeGroundColor = Color.SaddleBrown;
cs2.UsePrimaryAxis = false;
var cs3 = (ChartSerie)chart.Series[2];
cs3.SerieType = ExcelChartType.ColumnStacked;
cs3.Format.Options.IsVaryColor = false;
cs3.DataPoints.DefaultDataPoint.DataLabels.HasValue = true;
cs3.DataFormat.ForeGroundColor = Color.CornflowerBlue;
cs3.UsePrimaryAxis = false;
book.SaveToFile( "CreatelineandstackedcolumnsChart.xlsx", ExcelVersion.Version2007);