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

How to set chart series from jQuery script?

1 Answer 100 Views
Chart
This is a migrated thread and some comments may be shown as answers.
IPV
Top achievements
Rank 1
IPV asked on 04 Dec 2014, 10:04 PM
I have a script like this:

$.ajax(
    {
        url: '@Url.Action("GetThrowData", "UserConsoleViewModels")',
        type: 'POST',
        dataType: 'json',
        data:
        {
            throwId: _throwId
        }
    }
    ).done(
        function (response) {
            console.log(response);
            $("#direction").text(response.Data.Action);
            $("#lblRawData").text(response.Data.RawData);
        }
    ).error(
        function (xhr, status, error) {
            alert(xhr.responseText);
    }
);                       


Right now the RawData property (a comma delimited list of floats) is just being printed to a label.  What I would like to do is apply it as a series in a chart similar to this:

@(Html.Kendo().Chart()
  .Name("currentGraph")
  .Title("Switch Current Graph")
  .Legend(legend => legend
      .Position(ChartLegendPosition.Bottom)
  
  .ValueAxis(axis => axis.Numeric()
      .Labels(labels => labels.Format("{0}"))
      .Title("Current")
  ).HtmlAttributes(new { style = "height:300px" })
  .Tooltip(tooltip => tooltip
      .Visible(true)
      .Format("{0}")
  )
)


How would I do that?

1 Answer, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 08 Dec 2014, 01:36 PM
Hello Morgan,

In this case the you should create the chart with javascript instead of using wrappers. You can examine this online example and you can try to build the chart with the response in the jquery ajax done.

I hope this helps.

Regards,
Hristo Germanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart
Asked by
IPV
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Share this question
or