VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
In This Topic
    XLSX: Work with charts on XLSX page
    In This Topic
    SpreadsheetEditorControl and WpfSpreadsheetEditorControl controls allow to work (view, add, edit and delete) with charts of XLSX worksheet in desktop (WinForms, WPF) application.

    Charts can be changed visually using mouse/keyboard or programmatically.


    List of supported standard chart types

    Here is the list of standard chart types, which are supported by the SDK:

    Add new chart to the XLSX worksheet

    If you want to add new chart, you need to provide an existing chart as a template for new chart.

    Here is C# and VB.NET code that demonstrates how to add a column chart to the focused XLSX worksheet:
    /// <summary>
    /// Adds the chart to a worksheet.
    /// </summary>
    /// <param name="editorControl">The spreadsheet editor control.</param>
    /// <param name="templateFilePath">A name of file that contains templates of charts.</param>
    /// <param name="worksheetIndex">A zero-based index of the worksheet that contains the chart.</param>
    /// <param name="chartIndex">A zero-based index of the chart that should be added.</param>
    public void AddChartToXlsxWorksheet(
        Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl editorControl,
        string chartTemplateFileName,
        int worksheetIndex,
        int chartIndex)
    {
        // get visual editor for spreadsheet document
        Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor spreadsheetVisualEditor = editorControl.VisualEditor;
    
        // open XLSX file that contains template chart
        using (Vintasoft.Imaging.Office.Spreadsheet.SpreadsheetEditorSource templateSource =
            new Vintasoft.Imaging.Office.Spreadsheet.SpreadsheetEditorSource(chartTemplateFileName))
        {
            // create the editor for template XLSX file
            using (Vintasoft.Imaging.Office.Spreadsheet.SpreadsheetEditor templateSourceEditor =
                new Vintasoft.Imaging.Office.Spreadsheet.SpreadsheetEditor(templateSource, false))
            {
                // initialize the editor
                templateSourceEditor.Initialize(new Vintasoft.Imaging.Office.Spreadsheet.SpreadsheetEditorSettings());
                // get worksheet by worksheet index
                Vintasoft.Imaging.Office.Spreadsheet.Document.Worksheet worksheet = templateSourceEditor.Document.Worksheets[worksheetIndex];
                // get the template chart by chart index
                Vintasoft.Imaging.Office.Spreadsheet.Document.SheetDrawing templateChart = worksheet.Drawings[chartIndex];
    
                // add new chart that is based on template chart
                spreadsheetVisualEditor.AddChart(worksheet, templateChart);
            }
        }
    }
    
    ''' <summary>
    ''' Adds the chart to a worksheet.
    ''' </summary>
    ''' <param name="editorControl">The spreadsheet editor control.</param>
    ''' <param name="templateFilePath">A name of file that contains templates of charts.</param>
    ''' <param name="worksheetIndex">A zero-based index of the worksheet that contains the chart.</param>
    ''' <param name="chartIndex">A zero-based index of the chart that should be added.</param>
    Public Sub AddChartToXlsxWorksheet(editorControl As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl, chartTemplateFileName As String, worksheetIndex As Integer, chartIndex As Integer)
        ' get visual editor for spreadsheet document
        Dim spreadsheetVisualEditor As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor = editorControl.VisualEditor
    
        ' open XLSX file that contains template chart
        Using templateSource As New Vintasoft.Imaging.Office.Spreadsheet.SpreadsheetEditorSource(chartTemplateFileName)
            ' create the editor for template XLSX file
            Using templateSourceEditor As New Vintasoft.Imaging.Office.Spreadsheet.SpreadsheetEditor(templateSource, False)
                ' initialize the editor
                templateSourceEditor.Initialize(New Vintasoft.Imaging.Office.Spreadsheet.SpreadsheetEditorSettings())
                ' get worksheet by worksheet index
                Dim worksheet As Vintasoft.Imaging.Office.Spreadsheet.Document.Worksheet = templateSourceEditor.Document.Worksheets(worksheetIndex)
                ' get the template chart by chart index
                Dim templateChart As Vintasoft.Imaging.Office.Spreadsheet.Document.SheetDrawing = worksheet.Drawings(chartIndex)
    
                ' add new chart that is based on template chart
                spreadsheetVisualEditor.AddChart(worksheet, templateChart)
            End Using
        End Using
    End Sub
    


    Chart data: Set the series data of the chart

    If you want to set the series data of the chart using mouse, you should do the following steps:


    Chart data: Set the category data of the chart

    If you want to set the category data of the chart using mouse, you should do the following steps:


    Chart appearance: Set the axis labels for the chart

    If you want to set the axis labels for the chart using mouse, you should do the following steps:


    Chart data: Set the chart data (series, categories, axis labels) of the chart

    Here is C# and VB.NET code that demonstrates how to change the chart data of a chart on XLSX worksheet:
    /// <summary>
    /// Changes the chart data (categories name, series name and series values) for chart in SalesReport.xlsx file.
    /// </summary>
    /// <param name="editorControl">The spreadsheet editor control.</param>
    public void SetDataOfXlsxChart(Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl editorControl)
    {
        // get visual editor for spreadsheet document
        Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor spreadsheetVisualEditor = editorControl.VisualEditor;
    
        // create worksheet editor
        Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.WorksheetEditor worksheetEditor =
            spreadsheetVisualEditor.Editor.StartEditing(spreadsheetVisualEditor.FocusedWorksheet);
        try
        {
            // create editor for focused chart
            Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.SheetDrawingEditor chartEditor =
                worksheetEditor.CreateDrawingEditor(spreadsheetVisualEditor.FocusedDrawing);
            // create editor for chart properties
            Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartPropertiesEditor chartPropertiesEditor =
                chartEditor.CreateChartPropertiesEditor();
    
            // create the cell references, which reference cells region "D6:F6" as cells for data of chart categories
            Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences categoriesReferences =
                Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.CreateFixedReferences(
                Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.Parse("D6:F6"),
                spreadsheetVisualEditor.FocusedWorksheet.Name,
                true, true);
    
            // create the cell references, which reference cells region "C7:C10" as cells for data of chart series
            Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences seriesReferences =
                Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.CreateFixedReferences(
                Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.Parse("C7:C10"),
                spreadsheetVisualEditor.FocusedWorksheet.Name,
                true, true);
    
            // create the cell references, which reference cells region "D7:F10" as cells for data of chart series data
            Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences seriesDataReferences =
                Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.CreateFixedReferences(
                Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.Parse("D7:F10"),
                spreadsheetVisualEditor.FocusedWorksheet.Name,
                true, true);
    
            // union all references
            Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences references =
                Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.Union(categoriesReferences,
                Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.Union(seriesReferences, seriesDataReferences));
    
            // set data references for chart
            chartPropertiesEditor.SetDataReferences(references);
        }
        finally
        {
            spreadsheetVisualEditor.Editor.FinishEditing();
        }
    }
    
    ''' <summary>
    ''' Changes the chart data (categories name, series name and series values) for chart in SalesReport.xlsx file.
    ''' </summary>
    ''' <param name="editorControl">The spreadsheet editor control.</param>
    Public Sub SetDataOfXlsxChart(editorControl As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl)
        ' get visual editor for spreadsheet document
        Dim spreadsheetVisualEditor As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor = editorControl.VisualEditor
    
        ' create worksheet editor
        Dim worksheetEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.WorksheetEditor = spreadsheetVisualEditor.Editor.StartEditing(spreadsheetVisualEditor.FocusedWorksheet)
        Try
            ' create editor for focused chart
            Dim chartEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.SheetDrawingEditor = worksheetEditor.CreateDrawingEditor(spreadsheetVisualEditor.FocusedDrawing)
            ' create editor for chart properties
            Dim chartPropertiesEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartPropertiesEditor = chartEditor.CreateChartPropertiesEditor()
    
            ' create the cell references, which reference cells region "D6:F6" as cells for data of chart categories
            Dim categoriesReferences As Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences = Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.CreateFixedReferences(Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.Parse("D6:F6"), spreadsheetVisualEditor.FocusedWorksheet.Name, True, True)
    
            ' create the cell references, which reference cells region "C7:C10" as cells for data of chart series
            Dim seriesReferences As Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences = Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.CreateFixedReferences(Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.Parse("C7:C10"), spreadsheetVisualEditor.FocusedWorksheet.Name, True, True)
    
            ' create the cell references, which reference cells region "D7:F10" as cells for data of chart series data
            Dim seriesDataReferences As Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences = Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.CreateFixedReferences(Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.Parse("D7:F10"), spreadsheetVisualEditor.FocusedWorksheet.Name, True, True)
    
            ' union all references
            Dim references As Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences = Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.Union(categoriesReferences, Vintasoft.Imaging.Office.Spreadsheet.Document.CellReferences.Union(seriesReferences, seriesDataReferences))
    
            ' set data references for chart
            chartPropertiesEditor.SetDataReferences(references)
        Finally
            spreadsheetVisualEditor.Editor.FinishEditing()
        End Try
    End Sub
    


    Chart appearance: Set the title of the chart

    Here is C# and VB.NET code that demonstrates how to set the text and font of a chart title:
    /// <summary>
    /// Sets the chart title and font properties.
    /// </summary>
    /// <param name="editorControl">The spreadsheet editor control.</param>
    /// <param name="fontProperties">The title font properties.</param>
    /// <param name="title">The title text.</param>
    public void SetTitleOfXlsxChart(
        Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl editorControl, 
        Vintasoft.Imaging.Office.Spreadsheet.Document.FontProperties fontProperties,
        string title)
    {
        // get visual editor for spreadsheet document
        Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor spreadsheetVisualEditor = editorControl.VisualEditor;
    
        // create worksheet editor
        Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.WorksheetEditor worksheetEditor =
            spreadsheetVisualEditor.Editor.StartEditing(spreadsheetVisualEditor.FocusedWorksheet);
        try
        {
            // create editor for focused chart
            Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.SheetDrawingEditor chartEditor =
                worksheetEditor.CreateDrawingEditor(spreadsheetVisualEditor.FocusedDrawing);
            // create editor for chart properties
            Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartPropertiesEditor chartPropertiesEditor =
                chartEditor.CreateChartPropertiesEditor();
    
            // set title of the chart
            chartPropertiesEditor.SetTitle(title);
    
            // create the text appearance
            Vintasoft.Imaging.Office.Spreadsheet.Document.TextAppearance textAppearance = new Vintasoft.Imaging.Office.Spreadsheet.Document.TextAppearance(
                    fontProperties,
                    new Vintasoft.Imaging.Office.Spreadsheet.Document.TextProperties());
    
            // create the text and shape appearance
            Vintasoft.Imaging.Office.Spreadsheet.Document.TextShapeAppearance appearance = new Vintasoft.Imaging.Office.Spreadsheet.Document.TextShapeAppearance(
                textAppearance,
                chartPropertiesEditor.ChartProperties.TitleAppearance.ShapeAppearance);
    
            chartPropertiesEditor.SetTitleAppearance(appearance);
        }
        finally
        {
            spreadsheetVisualEditor.Editor.FinishEditing();
        }
    }
    
    ''' <summary>
    ''' Sets the chart title and font properties.
    ''' </summary>
    ''' <param name="editorControl">The spreadsheet editor control.</param>
    ''' <param name="fontProperties">The title font properties.</param>
    ''' <param name="title">The title text.</param>
    Public Sub SetTitleOfXlsxChart(editorControl As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl, fontProperties As Vintasoft.Imaging.Office.Spreadsheet.Document.FontProperties, title As String)
        ' get visual editor for spreadsheet document
        Dim spreadsheetVisualEditor As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor = editorControl.VisualEditor
    
        ' create worksheet editor
        Dim worksheetEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.WorksheetEditor = spreadsheetVisualEditor.Editor.StartEditing(spreadsheetVisualEditor.FocusedWorksheet)
        Try
            ' create editor for focused chart
            Dim chartEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.SheetDrawingEditor = worksheetEditor.CreateDrawingEditor(spreadsheetVisualEditor.FocusedDrawing)
            ' create editor for chart properties
            Dim chartPropertiesEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartPropertiesEditor = chartEditor.CreateChartPropertiesEditor()
    
            ' set title of the chart
            chartPropertiesEditor.SetTitle(title)
    
            ' create the text appearance
            Dim textAppearance As New Vintasoft.Imaging.Office.Spreadsheet.Document.TextAppearance(fontProperties, New Vintasoft.Imaging.Office.Spreadsheet.Document.TextProperties())
    
            ' create the text and shape appearance
            Dim appearance As New Vintasoft.Imaging.Office.Spreadsheet.Document.TextShapeAppearance(textAppearance, chartPropertiesEditor.ChartProperties.TitleAppearance.ShapeAppearance)
    
            chartPropertiesEditor.SetTitleAppearance(appearance)
        Finally
            spreadsheetVisualEditor.Editor.FinishEditing()
        End Try
    End Sub
    


    Chart appearance: Set the color of plot area and chart area of the chart

    Here is C# and VB.NET code that demonstrates how to set the color of plot area and chart area of the chart:
    /// <summary>
    /// Sets the chart background color and the plot area background color.
    /// </summary>
    /// <param name="editorControl">The spreadsheet editor control.</param>
    /// <param name="chartBackgroundColor">The chart background color.</param>
    /// <param name="plotAreaBackgroundColor">The plot area background color.</param>
    public void SetColorForPlotAndChartAreaOfXlsxChart(
        Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl editorControl,
        Vintasoft.Primitives.VintasoftColor chartBackgroundColor,
        Vintasoft.Primitives.VintasoftColor plotAreaBackgroundColor)
    {
        // get visual editor for spreadsheet document
        Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor spreadsheetVisualEditor = editorControl.VisualEditor;
    
        // create worksheet editor
        Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.WorksheetEditor worksheetEditor =
            spreadsheetVisualEditor.Editor.StartEditing(spreadsheetVisualEditor.FocusedWorksheet);
        try
        {
            // create editor for focused chart
            Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.SheetDrawingEditor chartEditor =
                worksheetEditor.CreateDrawingEditor(spreadsheetVisualEditor.FocusedDrawing);
            // create editor for chart properties
            Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartPropertiesEditor chartPropertiesEditor =
                chartEditor.CreateChartPropertiesEditor();
    
            // set the chart appearance
            chartPropertiesEditor.SetChartAreaAppearance(new Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance(
                chartBackgroundColor,
                chartPropertiesEditor.ChartProperties.ChartAreaAppearance.OutlineColor,
                chartPropertiesEditor.ChartProperties.ChartAreaAppearance.OutlineWidth));
            // set the plot area appearance
            chartPropertiesEditor.SetPlotAreaAppearance(new Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance(
                plotAreaBackgroundColor,
                chartPropertiesEditor.ChartProperties.PlotAreaAppearance.OutlineColor,
                chartPropertiesEditor.ChartProperties.PlotAreaAppearance.OutlineWidth));
        }
        finally
        {
            spreadsheetVisualEditor.Editor.FinishEditing();
        }
    }
    
    ''' <summary>
    ''' Sets the chart background color and the plot area background color.
    ''' </summary>
    ''' <param name="editorControl">The spreadsheet editor control.</param>
    ''' <param name="chartBackgroundColor">The chart background color.</param>
    ''' <param name="plotAreaBackgroundColor">The plot area background color.</param>
    Public Sub SetColorForPlotAndChartAreaOfXlsxChart(editorControl As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl, chartBackgroundColor As Vintasoft.Primitives.VintasoftColor, plotAreaBackgroundColor As Vintasoft.Primitives.VintasoftColor)
        ' get visual editor for spreadsheet document
        Dim spreadsheetVisualEditor As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor = editorControl.VisualEditor
    
        ' create worksheet editor
        Dim worksheetEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.WorksheetEditor = spreadsheetVisualEditor.Editor.StartEditing(spreadsheetVisualEditor.FocusedWorksheet)
        Try
            ' create editor for focused chart
            Dim chartEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.SheetDrawingEditor = worksheetEditor.CreateDrawingEditor(spreadsheetVisualEditor.FocusedDrawing)
            ' create editor for chart properties
            Dim chartPropertiesEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartPropertiesEditor = chartEditor.CreateChartPropertiesEditor()
    
            ' set the chart appearance
            chartPropertiesEditor.SetChartAreaAppearance(New Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance(chartBackgroundColor, chartPropertiesEditor.ChartProperties.ChartAreaAppearance.OutlineColor, chartPropertiesEditor.ChartProperties.ChartAreaAppearance.OutlineWidth))
            ' set the plot area appearance
            chartPropertiesEditor.SetPlotAreaAppearance(New Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance(plotAreaBackgroundColor, chartPropertiesEditor.ChartProperties.PlotAreaAppearance.OutlineColor, chartPropertiesEditor.ChartProperties.PlotAreaAppearance.OutlineWidth))
        Finally
            spreadsheetVisualEditor.Editor.FinishEditing()
        End Try
    End Sub
    


    Chart appearance: Set the colors for the chart series of chart

    Here is C# and VB.NET code that demonstrates how to set colors for the chart series of chart:
    /// <summary>
    /// Sets the colors for the specified chart series.
    /// </summary>
    /// <param name="editorControl">The spreadsheet editor control.</param>
    /// <param name="seriesIndex">Index of the series.</param>
    public void SetColorsForChartSeriesOfXlsxChart(
        Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl editorControl,
        int seriesIndex)
    {
        // get visual editor for spreadsheet document
        Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor spreadsheetVisualEditor = editorControl.VisualEditor;
    
        // create worksheet editor
        Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.WorksheetEditor worksheetEditor =
            spreadsheetVisualEditor.Editor.StartEditing(spreadsheetVisualEditor.FocusedWorksheet);
        try
        {
            // create editor for focused chart
            Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.SheetDrawingEditor chartEditor =
                worksheetEditor.CreateDrawingEditor(spreadsheetVisualEditor.FocusedDrawing);
            // create editor for chart properties
            Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartPropertiesEditor chartPropertiesEditor =
                chartEditor.CreateChartPropertiesEditor();
            // create editor for chart series
            Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartDataSeriesEditor seriesEditor =
                chartPropertiesEditor.CreateChartDataSeriesEditor(chartPropertiesEditor.ChartProperties.Series[seriesIndex]);
    
            Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance appearance = new Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance(
                Vintasoft.Primitives.VintasoftColor.Black,
                Vintasoft.Primitives.VintasoftColor.Red, 3);
    
            // set appearance for chart series
            seriesEditor.SetAppearanceProperties(appearance);
        }
        finally
        {
            spreadsheetVisualEditor.Editor.FinishEditing();
        }
    }
    
    ''' <summary>
    ''' Sets the colors for the specified chart series.
    ''' </summary>
    ''' <param name="editorControl">The spreadsheet editor control.</param>
    ''' <param name="seriesIndex">Index of the series.</param>
    Public Sub SetColorsForChartSeriesOfXlsxChart(editorControl As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl, seriesIndex As Integer)
        ' get visual editor for spreadsheet document
        Dim spreadsheetVisualEditor As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor = editorControl.VisualEditor
    
        ' create worksheet editor
        Dim worksheetEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.WorksheetEditor = spreadsheetVisualEditor.Editor.StartEditing(spreadsheetVisualEditor.FocusedWorksheet)
        Try
            ' create editor for focused chart
            Dim chartEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.SheetDrawingEditor = worksheetEditor.CreateDrawingEditor(spreadsheetVisualEditor.FocusedDrawing)
            ' create editor for chart properties
            Dim chartPropertiesEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartPropertiesEditor = chartEditor.CreateChartPropertiesEditor()
            ' create editor for chart series
            Dim seriesEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartDataSeriesEditor = chartPropertiesEditor.CreateChartDataSeriesEditor(chartPropertiesEditor.ChartProperties.Series(seriesIndex))
    
            Dim appearance As New Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance(Vintasoft.Primitives.VintasoftColor.Black, Vintasoft.Primitives.VintasoftColor.Red, 3)
    
            ' set appearance for chart series
            seriesEditor.SetAppearanceProperties(appearance)
        Finally
            spreadsheetVisualEditor.Editor.FinishEditing()
        End Try
    End Sub
    


    Chart appearance: Set the colors for the chart data points of chart

    Here is C# and VB.NET code that demonstrates how to set colors for the chart data points of chart:
    /// <summary>
    /// Sets the colors for chart data points.
    /// </summary>
    /// <param name="editorControl">The spreadsheet editor control.</param>
    /// <param name="seriesIndex">A zero-based index of the chart series.</param>
    public void SetColorsForChartDataPointsOfXlsxChart(
        Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl editorControl,
        int seriesIndex)
    {
        // get visual editor for spreadsheet document
        Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor spreadsheetVisualEditor = editorControl.VisualEditor;
    
        // create worksheet editor
        Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.WorksheetEditor worksheetEditor =
            spreadsheetVisualEditor.Editor.StartEditing(spreadsheetVisualEditor.FocusedWorksheet);
        try
        {
            // create editor for focused chart
            Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.SheetDrawingEditor chartEditor =
                worksheetEditor.CreateDrawingEditor(spreadsheetVisualEditor.FocusedDrawing);
            // create editor for chart properties
            Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartPropertiesEditor chartPropertiesEditor =
                chartEditor.CreateChartPropertiesEditor();
            // create editor for chart series
            Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartDataSeriesEditor seriesEditor =
                chartPropertiesEditor.CreateChartDataSeriesEditor(chartPropertiesEditor.ChartProperties.Series[seriesIndex]);
    
            // create new data points
            Vintasoft.Imaging.Office.Spreadsheet.Document.ChartDataPoint[] dataPoints =
                new Vintasoft.Imaging.Office.Spreadsheet.Document.ChartDataPoint[seriesEditor.Series.DataPoints.Length];
    
            for (int i = 0; i < dataPoints.Length; i++)
            {
                // get data point from chart
                Vintasoft.Imaging.Office.Spreadsheet.Document.ChartDataPoint dataPoint = seriesEditor.Series.DataPoints[i];
                Vintasoft.Imaging.Office.Spreadsheet.Document.ChartMarker marker = null;
    
                // if data point has marker
                if (dataPoint.Marker != null)
                {
                    Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance dataPointMarkerAppearance = new Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance(
                        Vintasoft.Primitives.VintasoftColor.Red,
                        Vintasoft.Primitives.VintasoftColor.Blue, 3);
    
                    // create new marker for new data point
                    marker = new Vintasoft.Imaging.Office.Spreadsheet.Document.ChartMarker(
                        dataPoint.Marker.Style,
                        dataPoint.Marker.Size,
                        dataPointMarkerAppearance);
                }
    
                Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance dataPointAppearance = new Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance(
                    Vintasoft.Primitives.VintasoftColor.Black,
                    Vintasoft.Primitives.VintasoftColor.Green, 3);
    
                // change the color of new data point
                dataPoints[i] = new Vintasoft.Imaging.Office.Spreadsheet.Document.ChartDataPoint(marker, dataPointAppearance);
            }
    
            // set new data points for chart
            seriesEditor.SetDataPoints(dataPoints);
        }
        finally
        {
            spreadsheetVisualEditor.Editor.FinishEditing();
        }
    }
    
    ''' <summary>
    ''' Sets the colors for chart data points.
    ''' </summary>
    ''' <param name="editorControl">The spreadsheet editor control.</param>
    ''' <param name="seriesIndex">A zero-based index of the chart series.</param>
    Public Sub SetColorsForChartDataPointsOfXlsxChart(editorControl As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl, seriesIndex As Integer)
        ' get visual editor for spreadsheet document
        Dim spreadsheetVisualEditor As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor = editorControl.VisualEditor
    
        ' create worksheet editor
        Dim worksheetEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.WorksheetEditor = spreadsheetVisualEditor.Editor.StartEditing(spreadsheetVisualEditor.FocusedWorksheet)
        Try
            ' create editor for focused chart
            Dim chartEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.SheetDrawingEditor = worksheetEditor.CreateDrawingEditor(spreadsheetVisualEditor.FocusedDrawing)
            ' create editor for chart properties
            Dim chartPropertiesEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartPropertiesEditor = chartEditor.CreateChartPropertiesEditor()
            ' create editor for chart series
            Dim seriesEditor As Vintasoft.Imaging.Office.Spreadsheet.Document.Editors.ChartDataSeriesEditor = chartPropertiesEditor.CreateChartDataSeriesEditor(chartPropertiesEditor.ChartProperties.Series(seriesIndex))
    
            ' create new data points
            Dim dataPoints As Vintasoft.Imaging.Office.Spreadsheet.Document.ChartDataPoint() = New Vintasoft.Imaging.Office.Spreadsheet.Document.ChartDataPoint(seriesEditor.Series.DataPoints.Length - 1) {}
    
            For i As Integer = 0 To dataPoints.Length - 1
                ' get data point from chart
                Dim dataPoint As Vintasoft.Imaging.Office.Spreadsheet.Document.ChartDataPoint = seriesEditor.Series.DataPoints(i)
                Dim marker As Vintasoft.Imaging.Office.Spreadsheet.Document.ChartMarker = Nothing
    
                ' if data point has marker
                If dataPoint.Marker IsNot Nothing Then
                    Dim dataPointMarkerAppearance As New Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance(Vintasoft.Primitives.VintasoftColor.Red, Vintasoft.Primitives.VintasoftColor.Blue, 3)
    
                    ' create new marker for new data point
                    marker = New Vintasoft.Imaging.Office.Spreadsheet.Document.ChartMarker(dataPoint.Marker.Style, dataPoint.Marker.Size, dataPointMarkerAppearance)
                End If
    
                Dim dataPointAppearance As New Vintasoft.Imaging.Office.Spreadsheet.Document.ShapeAppearance(Vintasoft.Primitives.VintasoftColor.Black, Vintasoft.Primitives.VintasoftColor.Green, 3)
    
                ' change the color of new data point
                dataPoints(i) = New Vintasoft.Imaging.Office.Spreadsheet.Document.ChartDataPoint(marker, dataPointAppearance)
            Next
    
            ' set new data points for chart
            seriesEditor.SetDataPoints(dataPoints)
        Finally
            spreadsheetVisualEditor.Editor.FinishEditing()
        End Try
    End Sub
    


    Resize a chart of XLSX worksheet

    If you want to resize the chart of XLSX worksheet using mouse, you should do the following steps:


    Move a chart of XLSX worksheet

    If you want to move (reposition) the chart of XLSX worksheet using mouse, you should do the following steps:


    Delete the chart from XLSX worksheet

    Here is C# and VB.NET code that demonstrates how to delete the chart from XLSX worksheet:
    /// <summary>
    /// Removes the focused chart from worksheet.
    /// </summary>
    /// <param name="editorControl">The spreadsheet editor control.</param>
    public void RemoveFocusedChartFromXlsxWorksheet(Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl editorControl)
    {
        // remove focused drawing (picture, chart, graphics)
        editorControl.VisualEditor.RemoveFocusedDrawing();
    }
    
    ''' <summary>
    ''' Removes the focused chart from worksheet.
    ''' </summary>
    ''' <param name="editorControl">The spreadsheet editor control.</param>
    Public Sub RemoveFocusedChartFromXlsxWorksheet(editorControl As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetEditorControl)
        ' remove focused drawing (picture, chart, graphics)
        editorControl.VisualEditor.RemoveFocusedDrawing()
    End Sub