FlexChart | ComponentOne
Elements / Axes / Draw Gridlines on Chart
In This Topic
    Draw Gridlines on Chart
    In This Topic

    FlexChart provides you the option to draw gridlines in front of or behind the chart data. For this, the control provides AxesOnTop property of FlexChart class to control the appearance of gridlines.

    A moving image which shows gridlines on chart data.

    Here, in the above use-case, we have used a button event to draw gridlines on chart at runtime.

    private void button1_Click(object sender, EventArgs e)
    {
      
        // for Odd clicks, ie., if the user clicks for the first time, the third time and so on.
        if (myVar % 2 == 0)
        {
            flexChart1.AxesOnTop = true;
        }
        // for Even clicks, if the user clicks for the second time, the fourth time and so on.
        else
        {
            flexChart1.AxesOnTop = false;
        }
        // Increment myVar.  
        myVar = myVar + 1;
    }
    
    Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
         ' for Odd clicks, ie., if the user clicks for the first time, the third time and so on.
        If myVar Mod 2 = 0 Then
             flexChart1.AxesOnTop = True
         Else
        ' for Even clicks, if the user clicks for the second time, the fourth time and so on.
             flexChart1.AxesOnTop = False
         End If
        'Increment myVar
        myVar = myVar + 1
     End Sub