public SLC.SLChart CreateChart(string StartCellReference, string EndCellReference, bool RowsAsDataSeries, bool ShowHiddenData)
        {
            int iStartRowIndex = -1;
            int iStartColumnIndex = -1;
            int iEndRowIndex = -1;
            int iEndColumnIndex = -1;
            if (!SLTool.FormatCellReferenceToRowColumnIndex(StartCellReference, out iStartRowIndex, out iStartColumnIndex))
            {
                iStartRowIndex = -1;
                iStartColumnIndex = -1;
            }
            if (!SLTool.FormatCellReferenceToRowColumnIndex(EndCellReference, out iEndRowIndex, out iEndColumnIndex))
            {
                iEndRowIndex = -1;
                iEndColumnIndex = -1;
            }

            SLC.SLCreateChartOptions Options = new SLC.SLCreateChartOptions();
            Options.RowsAsDataSeries = RowsAsDataSeries;
            Options.ShowHiddenData = ShowHiddenData;
            return this.CreateChartInternal(gsSelectedWorksheetName, iStartRowIndex, iStartColumnIndex, iEndRowIndex, iEndColumnIndex, Options);
        }
        private SLC.SLChart CreateChartInternal(string WorksheetName, int StartRowIndex, int StartColumnIndex, int EndRowIndex, int EndColumnIndex, SLC.SLCreateChartOptions Options)
        {
            if (Options == null) Options = new SLC.SLCreateChartOptions();

            SLC.SLChart chart = new SLC.SLChart();

            int iStartRowIndex = 1, iEndRowIndex = 1, iStartColumnIndex = 1, iEndColumnIndex = 1;
            if (StartRowIndex < EndRowIndex)
            {
                iStartRowIndex = StartRowIndex;
                iEndRowIndex = EndRowIndex;
            }
            else
            {
                iStartRowIndex = EndRowIndex;
                iEndRowIndex = StartRowIndex;
            }

            if (StartColumnIndex < EndColumnIndex)
            {
                iStartColumnIndex = StartColumnIndex;
                iEndColumnIndex = EndColumnIndex;
            }
            else
            {
                iStartColumnIndex = EndColumnIndex;
                iEndColumnIndex = StartColumnIndex;
            }

            if (iStartRowIndex < 1) iStartRowIndex = 1;
            if (iStartColumnIndex < 1) iStartColumnIndex = 1;
            if (iEndRowIndex > SLConstants.RowLimit) iEndRowIndex = SLConstants.RowLimit;
            if (iEndColumnIndex > SLConstants.ColumnLimit) iEndColumnIndex = SLConstants.ColumnLimit;

            // this will keep the calculations within workable range
            if (iStartRowIndex >= SLConstants.RowLimit) iStartRowIndex = SLConstants.RowLimit - 1;
            if (iStartColumnIndex >= SLConstants.ColumnLimit) iStartColumnIndex = SLConstants.ColumnLimit - 1;

            chart.WorksheetName = WorksheetName;

            if (Options.RowsAsDataSeries == null)
            {
                if ((iEndColumnIndex - iStartColumnIndex) >= (iEndRowIndex - iStartRowIndex))
                {
                    chart.RowsAsDataSeries = true;
                }
                else
                {
                    chart.RowsAsDataSeries = false;
                }
            }
            else
            {
                chart.RowsAsDataSeries = Options.RowsAsDataSeries.Value;
            }

            chart.ShowHiddenData = Options.ShowHiddenData;
            chart.ShowDataLabelsOverMaximum = Options.IsStylish ? false : true;

            int i;
            chart.listThemeColors = new List<System.Drawing.Color>();
            for (i = 0; i < SimpleTheme.listThemeColors.Count; ++i)
            {
                chart.listThemeColors.Add(SimpleTheme.listThemeColors[i]);
            }

            chart.Date1904 = this.slwb.WorkbookProperties.Date1904;
            chart.IsStylish = Options.IsStylish;
            chart.RoundedCorners = false;

            // assume combination charts are possible first
            chart.IsCombinable = true;

            chart.PlotArea = new SLC.SLPlotArea(SimpleTheme.listThemeColors, slwb.WorkbookProperties.Date1904, Options.IsStylish);
            chart.PlotArea.DataSeries = this.FillChartDataSeries(WorksheetName, StartRowIndex, StartColumnIndex, EndRowIndex, EndColumnIndex, chart.RowsAsDataSeries, chart.ShowHiddenData);
            chart.SetPlotAreaAxes();

            chart.HasShownSecondaryTextAxis = false;

            chart.StartRowIndex = iStartRowIndex;
            chart.StartColumnIndex = iStartColumnIndex;
            chart.EndRowIndex = iEndRowIndex;
            chart.EndColumnIndex = iEndColumnIndex;

            chart.ShowEmptyCellsAs = Options.IsStylish ? C.DisplayBlanksAsValues.Zero : C.DisplayBlanksAsValues.Gap;
            chart.ChartStyle = SLC.SLChartStyle.Style2;

            chart.ChartName = string.Format("Chart {0}", slws.Charts.Count + 1);

            chart.HasTitle = false;
            chart.Title = new SLC.SLTitle(SimpleTheme.listThemeColors, Options.IsStylish);
            chart.Title.Overlay = false;

            chart.Is3D = false;
            chart.Floor = new SLC.SLFloor(SimpleTheme.listThemeColors, Options.IsStylish);
            chart.SideWall = new SLC.SLSideWall(SimpleTheme.listThemeColors, Options.IsStylish);
            chart.BackWall = new SLC.SLBackWall(SimpleTheme.listThemeColors, Options.IsStylish);

            chart.ShowLegend = true;
            chart.Legend = new SLC.SLLegend(SimpleTheme.listThemeColors, Options.IsStylish);
            chart.Legend.Overlay = false;
            if (Options.IsStylish)
            {
                chart.Legend.LegendPosition = A.Charts.LegendPositionValues.Bottom;
            }

            chart.ShapeProperties = new SLA.SLShapeProperties(SimpleTheme.listThemeColors);

            if (Options.IsStylish)
            {
                chart.ShapeProperties.Fill.SetSolidFill(A.SchemeColorValues.Background1, 0, 0);
                chart.ShapeProperties.Outline.Width = 0.75m;
                chart.ShapeProperties.Outline.CapType = A.LineCapValues.Flat;
                chart.ShapeProperties.Outline.CompoundLineType = A.CompoundLineValues.Single;
                chart.ShapeProperties.Outline.Alignment = A.PenAlignmentValues.Center;
                chart.ShapeProperties.Outline.SetSolidLine(A.SchemeColorValues.Text1, 0.85m, 0);
                chart.ShapeProperties.Outline.JoinType = SLA.SLLineJoinValues.Round;
            }

            chart.TopPosition = 1;
            chart.LeftPosition = 1;
            chart.BottomPosition = 16;
            chart.RightPosition = 8.5;

            return chart;
        }
 public SLC.SLChart CreateChart(string WorksheetName, int StartRowIndex, int StartColumnIndex, int EndRowIndex, int EndColumnIndex, bool RowsAsDataSeries, bool ShowHiddenData)
 {
     SLC.SLCreateChartOptions Options = new SLC.SLCreateChartOptions();
     Options.RowsAsDataSeries = RowsAsDataSeries;
     Options.ShowHiddenData = ShowHiddenData;
     return this.CreateChartInternal(WorksheetName, StartRowIndex, StartColumnIndex, EndRowIndex, EndColumnIndex, Options);
 }