I need a chart with no x or y gridlines

Thread is closed for posting
4 posts, 0 answers
  1. Karl Wilkens
    Karl Wilkens avatar
    206 posts
    Member since:
    Oct 2012

    Posted 23 May 2013 Link to this post

    Hi,

    In the attached screen shot, I have some, but not all of the gridlines turned off. What I want is an ultra-clean presentation with no background grid at all and no x or y axis labels. Here is what I am doing right now but it results in the chart shown in the screen shot. Any help greatly appreciated.

    Dim rc As New RadChart

    rc.AutoLayout = True

    rc.AutoTextWrap = True

    rc.ChartTitle.Visible = False

    rc.Legend.Visible = False

    rc.PlotArea.XAxis.Appearance.LabelAppearance.Visible = False

    rc.PlotArea.YAxis.Appearance.LabelAppearance.Visible = False

    rc.PlotArea.XAxis.Appearance.MajorGridLines.Visible = False

    rc.PlotArea.YAxis.Appearance.MajorGridLines.Visible = False

    rc.PlotArea.XAxis.Appearance.MinorGridLines.Visible = False

    rc.PlotArea.XAxis.Appearance.MinorGridLines.Visible = False

    rc.PlotArea.YAxis.Appearance.LabelAppearance.Visible = False

    rc.PlotArea.XAxis.Appearance.LabelAppearance.Visible = False

                rc.PlotArea.XAxis.Appearance.MajorTick.Visible = False

                rc.PlotArea.XAxis.Appearance.MinorTick.Visible = False

                rc.PlotArea.YAxis.Appearance.MajorTick.Visible = False

                rc.PlotArea.YAxis.Appearance.MinorTick.Visible = False

  2. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 28 May 2013 Link to this post

    Hello Karl,

    Thank you for the screenshot and the code.

    First, make sure you are setting the right properties, because, for instance, in the code you have shared you have set twice:
    rc.PlotArea.XAxis.Appearance.MinorGridLines.Visible = False
    rc.PlotArea.XAxis.Appearance.MinorGridLines.Visible = False

    Second, if you are doing this at the Page_Load event, the properties might not take effect, because it is to early. It would be better if you do this at the PreRender event of the chart. In that event, you can set all the stuff you would like to do so.
    <telerik:RadChart ID="rc" runat="server" OnPreRender="rc_PreRender">

    Finally, If it is possible, we would advice you to do this declaratively, i.e. in HTML. Here is some sample HTML code how to do that.
    <telerik:RadChart ID="rc" runat="server" OnPreRender="rc_PreRender"
                      AutoLayout="true"
                      AutoTextWrap="true"
                      ChartTitle-Visible="false"
                      Legend-Visible="false">
        <Series>
        <telerik:ChartSeries Name="Sales">
            <items>
            <telerik:ChartSeriesItem YValue="34">
            <Label><TextBlock Text="Internet"></TextBlock></Label>
            </telerik:ChartSeriesItem>
            <telerik:ChartSeriesItem YValue="66">
            <Label><TextBlock Text="Wholesale"></TextBlock></Label>
            </telerik:ChartSeriesItem>
            <telerik:ChartSeriesItem YValue="27">
            <Label><TextBlock Text="Retail"></TextBlock></Label>
            </telerik:ChartSeriesItem>
            </items>
        </telerik:ChartSeries>
        </Series>
        <PlotArea>
            <XAxis>
                <Appearance MajorGridLines-Visible="false"
                            MinorGridLines-Visible="false"
                            MajorTick-Visible="false"
                            MinorTick-Visible="false"
                            LabelAppearance-Visible="false" />
            </XAxis>
            <YAxis>
                <Appearance MajorGridLines-Visible="false"
                            MinorGridLines-Visible="false"
                            MajorTick-Visible="false"
                            MinorTick-Visible="false"
                            LabelAppearance-Visible="false" />
            </YAxis>
        </PlotArea>
    </telerik:RadChart>

    Hope this helps.

    Regards, Rosko
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Karl Wilkens
    Karl Wilkens avatar
    206 posts
    Member since:
    Oct 2012

    Posted 12 Jun 2013 Link to this post

    Hi, I am dynamically creating these charts, so I am doing this 

            Dim rc As New RadChart

            AddHandler rc.PreRender, AddressOf RadChart1_PreRender


    ''' add series data

    rc.DataBind()


    And there is a handler 

        Sub RadChart1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs)

            Try

                sender.PlotArea.XAxis.Appearance.MajorGridLines.Visible = False

                sender.PlotArea.YAxis.Appearance.MajorGridLines.Visible = False

                sender.PlotArea.XAxis.Appearance.MinorGridLines.Visible = False

                sender.PlotArea.YAxis.Appearance.MinorGridLines.Visible = False

                sender.PlotArea.YAxis.Appearance.LabelAppearance.Visible = False

                sender.PlotArea.XAxis.Appearance.LabelAppearance.Visible = False

                sender.PlotArea.XAxis.Appearance.MajorTick.Visible = False

                sender.PlotArea.XAxis.Appearance.MinorTick.Visible = False

                sender.PlotArea.YAxis.Appearance.MajorTick.Visible = False

                sender.PlotArea.YAxis.Appearance.MinorTick.Visible = False

            Catch ex As Exception

            End Try

        End Sub


    But it handler never gets called. What am I doing wrong here?
  5. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 17 Jun 2013 Link to this post

    Hi Karl,

    From the details provided, it is hard to diagnose the issue. You can check out the attached project where dynamic creation of a chart is demonstrated and then had its gridlines properties set.

    If this does not help, can you please provide a sample project where the issue is demonstrated? Thank you for your cooperation!

    Regards,
    Rosko
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top