I was having trouble implementing a WCF Service for getting HTML chart data on the client side based on the example in the Demo "HtmlChart - Client-side Binding".
The trouble spot was in the setServiceDataInChart function. The demo site source code is:
I got two different errors when the code got to "chart.repaint();"
First problem was that my WCF service was not serving data back until I changed the OperationContract WebInvoke BodyStyle to WebMessageBodyStyle.WrappedRequest. This caused the second problem, namely, the value of newData returned was now wrapped, so I had to specify
in the setServiceDataInChart function.
The trouble spot was in the setServiceDataInChart function. The demo site source code is:
function setServiceDataInChart(sender, args){ //Get the returned data var newData = args.get_content(); //get a reference to the RadHtmlChart var chart = getChartReference(); //Set the new datasource to the RadHtmlChart chart.set_dataSource(newData); //Repaint the RadHtmlChart chart.repaint(); //Avoid raising the OnClientResponseEnded client-side event //avoid setting the received data as content for the RadXmlHttpPanel args.set_cancel(true); logEvent("<strong>Data from the WCF service:</strong>" + newData);}I got two different errors when the code got to "chart.repaint();"
First problem was that my WCF service was not serving data back until I changed the OperationContract WebInvoke BodyStyle to WebMessageBodyStyle.WrappedRequest. This caused the second problem, namely, the value of newData returned was now wrapped, so I had to specify
chart.set_dataSource(newData.d);in the setServiceDataInChart function.