This is a migrated thread and some comments may be shown as answers.

I need a chart with no x or y gridlines

3 Answers 53 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Karl Wilkens
Top achievements
Rank 1
Karl Wilkens asked on 23 May 2013, 02:57 PM
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

3 Answers, 1 is accepted

Sort by
0
Rosko
Telerik team
answered on 28 May 2013, 03:03 PM
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.
0
Karl Wilkens
Top achievements
Rank 1
answered on 12 Jun 2013, 07:00 PM
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?
0
Rosko
Telerik team
answered on 17 Jun 2013, 11:52 AM
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.
Tags
Chart (Obsolete)
Asked by
Karl Wilkens
Top achievements
Rank 1
Answers by
Rosko
Telerik team
Karl Wilkens
Top achievements
Rank 1
Share this question
or