How to manage RadNumericTextBox with AM Charts

0 Answers 51 Views
Designs, skins, themes
Swapnil
Top achievements
Rank 1
Swapnil asked on 03 Apr 2023, 02:29 PM

Hi Team,

 

We need a help related to "RadNumericTextBox" as we are using it with "AM Charts", we want to manage the charts and set resolution to a fixed number or set it to auto, so that it should get managed as per size of table and chart, the Telerik details we are using, Telerik version 2014.3.1024.45 with Asp.Net Webforms, Kindy request you to please give a solution.

 

Thank you

 

Rumen
Telerik team
commented on 03 Apr 2023, 03:19 PM

Hi Swapnil,

Telerik UI for ASP.NET AJAX does not offer out-of-the-box support for third-party libraries such as AM Charts. Having in mind that we are not familiar with AM Charts, what you can do is the experiment with the following information:

  • add a RadNumericTextBox control to your ASP.NET Web Forms page, which will allow the user to input the desired resolution.

    <telerik:RadNumericTextBox ID="resolutionTextBox" runat="server" Width="150px"></telerik:RadNumericTextBox>

  • Next, add a button control to the page, which will allow the user to apply the resolution settings to the chart

    <asp:Button ID="applyButton" runat="server" Text="Apply" OnClick="ApplyButton_Click" />


  • In the code-behind file, handle the button click event and set the resolution of the chart accordingly.

    protected void ApplyButton_Click(object sender, EventArgs e)
    {
        int resolution = (int)resolutionTextBox.Value;
        Chart1.Width = Unit.Pixel(resolution);
        Chart1.Height = Unit.Pixel(resolution);
        Chart1.DataSource = GetChartData(); //implement this function which should return the chart data
        Chart1.DataBind();
    }

    The code sets the width and height of the chart to the value entered in the RadNumericTextBox control, and then sets the chart's data source and binds the data to the chart. 

    Note that the above code is just an example and may need to be adapted to your specific use case and as per AM Charts API and docs/support guidance.

    Additionally, the Telerik UI for ASP.NET AJAX version you are using is very old and vulnerable to some critical vulnerabilities. It is highly recommended to upgrade to at least 2020.1.114 or even better the latest one to take advantage of security bug fixes and new features. You can find more information at https://docs.telerik.com/devtools/aspnet-ajax/knowledge-base/common-allows-javascriptserializer-deserialization

No answers yet. Maybe you can help?

Tags
Designs, skins, themes
Asked by
Swapnil
Top achievements
Rank 1
Share this question
or