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

radhtmlchart resetzoom option in asp.net

3 Answers 148 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
narendra
Top achievements
Rank 1
narendra asked on 22 Aug 2019, 03:32 PM

I have dynamically generated radhtmlcharts in asp.net page. after zooming into radhtmlchart I don't want to zoomout but I need an option for reset zoom in asp.net.

can anyone show me how to do rest of zoom feature for radhtmlchart in asp.net c#?

 

 

Thank you :)

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Vessy
Telerik team
answered on 27 Aug 2019, 03:42 PM

Hi Narenda,

RadHtmlChart does not expose a method that directly resets the zoom level, but you can achieve the same by resetting the min and max values of the y axis of the control in a similar way:

        <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="1640px" Height="480px">
            <Zoom Enabled="true">
                <MouseWheel Enabled="true" />
                <Selection Enabled="true" ModifierKey="Shift" />
            </Zoom>
            <PlotArea>
                <Series>
                    <telerik:ScatterLineSeries DataFieldY="SellQuantity" DataFieldX="SellDate">
                    </telerik:ScatterLineSeries>
                </Series>
                <XAxis BaseUnit="Seconds" BaseUnitStep="5" Step="1">
                </XAxis>
                <YAxis MinValue="0" MaxValue="10">
                </YAxis>

            </PlotArea>
            <Legend>
                <Appearance Visible="true" Position="Left"></Appearance>
            </Legend>
            <ChartTitle Text="Sold Cars per Date">
            </ChartTitle>
        </telerik:RadHtmlChart>
        <telerik:RadButton Text="Reset Zoom" runat="server" AutoPostBack="false" OnClientClicked="resetZoom"></telerik:RadButton>
        <script>
            function resetZoom() {
                var chart = $find("<%=RadHtmlChart1.ClientID%>").get_kendoWidget();
                chart.setOptions({
                    transitions: false,
                    categoryAxis: {
                        min: 0,
                        max: 10
                    }
                })
            }
        </script>

 

 

Regards,
Vessy
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
narendra
Top achievements
Rank 1
answered on 06 Sep 2019, 02:56 PM

Hi thank you very much vessy.. very nice name

the above script works fine. but I have dynamic radhtmlchart control created in c# with unique ID. how can I pass control id from c# server-side code to client-side script and rest zoom.

 

 

 

0
Accepted
Peter Milchev
Telerik team
answered on 11 Sep 2019, 11:09 AM

Hello Narendra,

You can execute a JavaScript code from the server-side as demonstrated in the following article:

If you need to reset many charts, you can add a CssClass to the chart and use it to get a reference to the HtmlChart using jQuery, as explained here:

Regards,
Peter Milchev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Chart (HTML5)
Asked by
narendra
Top achievements
Rank 1
Answers by
Vessy
Telerik team
narendra
Top achievements
Rank 1
Peter Milchev
Telerik team
Share this question
or