Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread.Chart Namespace / SpreadChart Class / CanSwitchRowColumn Property
Example


In This Topic
    CanSwitchRowColumn Property
    In This Topic
    Gets a value indicating whether the user can switch the rows and columns of the chart.
    Syntax
    'Declaration
     
    Public Overridable ReadOnly Property CanSwitchRowColumn As Boolean
    'Usage
     
    Dim instance As SpreadChart
    Dim value As Boolean
     
    value = instance.CanSwitchRowColumn
    public virtual bool CanSwitchRowColumn {get;}

    Property Value

    true if user can switch rows and columns of the chart; otherwise, false.
    Remarks
    This sets whether the user can switch the row and column on the chart.
    Example
    This example sets the CanSwitchRowColumn property.
    fpSpread1.Sheets[0].Cells[0, 1].Value = "c1";
    fpSpread1.Sheets[0].Cells[0, 2].Value = "c2";
    fpSpread1.Sheets[0].Cells[0, 3].Value = "c3";
    fpSpread1.Sheets[0].Cells[1, 0].Value = "s1";
    fpSpread1.Sheets[0].Cells[2, 0].Value = "s2";
    fpSpread1.Sheets[0].Cells[3, 0].Value = "s3";
    fpSpread1.Sheets[0].Cells[4, 0].Value = "s4";
    fpSpread1.Sheets[0].Cells[5, 0].Value = "s5";
    fpSpread1.Sheets[0].Cells[6, 0].Value = "s6";
    
    fpSpread1.Sheets[0].Cells[1, 1].Value = 1;
    fpSpread1.Sheets[0].Cells[2, 1].Value = 2;
    fpSpread1.Sheets[0].Cells[3, 1].Value = 3;
    fpSpread1.Sheets[0].Cells[4, 1].Value = 4;
    fpSpread1.Sheets[0].Cells[5, 1].Value = 5;
    fpSpread1.Sheets[0].Cells[6, 1].Value = 6;
    
    fpSpread1.Sheets[0].Cells[1, 2].Value = 7;
    fpSpread1.Sheets[0].Cells[2, 2].Value = 8;
    fpSpread1.Sheets[0].Cells[3, 2].Value = 9;
    fpSpread1.Sheets[0].Cells[4, 2].Value = 10;
    fpSpread1.Sheets[0].Cells[5, 2].Value = 11;
    fpSpread1.Sheets[0].Cells[6, 2].Value = 12;
    
    fpSpread1.Sheets[0].Cells[1, 3].Value = 13;
    fpSpread1.Sheets[0].Cells[2, 3].Value = 14;
    fpSpread1.Sheets[0].Cells[3, 3].Value = 15;
    fpSpread1.Sheets[0].Cells[4, 3].Value = 16;
    fpSpread1.Sheets[0].Cells[5, 3].Value = 17;
    fpSpread1.Sheets[0].Cells[6, 3].Value = 18;
             
    fpSpread1.Sheets[0].AddChart(0,0,typeof(FarPoint.Win.Chart.BarSeries),400,400,0,0,FarPoint.Win.Chart.ChartViewType.View2D, true);
    FarPoint.Win.Spread.Chart.SpreadChart chart = fpSpread1.Sheets[0].Charts[0];
    chart.Formula = " Sheet1!$A$1:$D$7";
    chart.ContextMenuStrip = new FarPoint.Win.Spread.Chart.SpreadChartContextMenuStrip(chart);
    if (chart.CanSwitchRowColumn)
    chart.SwitchRowColumn();
    fpSpread1.Sheets(0).Cells(0, 1).Value = "c1"
    fpSpread1.Sheets(0).Cells(0, 2).Value = "c2"
    fpSpread1.Sheets(0).Cells(0, 3).Value = "c3"
    fpSpread1.Sheets(0).Cells(1, 0).Value = "s1"
    fpSpread1.Sheets(0).Cells(2, 0).Value = "s2"
    fpSpread1.Sheets(0).Cells(3, 0).Value = "s3"
    fpSpread1.Sheets(0).Cells(4, 0).Value = "s4"
    fpSpread1.Sheets(0).Cells(5, 0).Value = "s5"
    fpSpread1.Sheets(0).Cells(6, 0).Value = "s6"
    
    fpSpread1.Sheets(0).Cells(1, 1).Value = 1
    fpSpread1.Sheets(0).Cells(2, 1).Value = 2
    fpSpread1.Sheets(0).Cells(3, 1).Value = 3
    fpSpread1.Sheets(0).Cells(4, 1).Value = 4
    fpSpread1.Sheets(0).Cells(5, 1).Value = 5
    fpSpread1.Sheets(0).Cells(6, 1).Value = 6
    
    fpSpread1.Sheets(0).Cells(1, 2).Value = 7
    fpSpread1.Sheets(0).Cells(2, 2).Value = 8
    fpSpread1.Sheets(0).Cells(3, 2).Value = 9
    fpSpread1.Sheets(0).Cells(4, 2).Value = 10
    fpSpread1.Sheets(0).Cells(5, 2).Value = 11
    fpSpread1.Sheets(0).Cells(6, 2).Value = 12
    
    fpSpread1.Sheets(0).Cells(1, 3).Value = 13
    fpSpread1.Sheets(0).Cells(2, 3).Value = 14
    fpSpread1.Sheets(0).Cells(3, 3).Value = 15
    fpSpread1.Sheets(0).Cells(4, 3).Value = 16
    fpSpread1.Sheets(0).Cells(5, 3).Value = 17
    fpSpread1.Sheets(0).Cells(6, 3).Value = 18
    
    fpSpread1.Sheets(0).AddChart(0, 0, GetType(FarPoint.Win.Chart.BarSeries), 400, 400, 0, 0, FarPoint.Win.Chart.ChartViewType.View2D, True)
    Dim chart As FarPoint.Win.Spread.Chart.SpreadChart
    chart = fpSpread1.Sheets(0).Charts(0)
    chart.Formula = " Sheet1!$A$1:$D$7"
    chart.ContextMenuStrip = New FarPoint.Win.Spread.Chart.SpreadChartContextMenuStrip(chart)
    If (chart.CanSwitchRowColumn) Then
    chart.SwitchRowColumn()
    End If
    See Also