score:2
Accepted answer
list is not serializable to web method instead of this you can return object[].
[webmethod]
public object[] getprogram12months(string usersessionid)
{
list<object> idata = new list<object>();
list<string> labels = new list<string>();
//first get distinct month name for select year.
string query1 = "select distinct top (100) percent timeframe from dbo.csq_programcount12months order by timeframe ";
string conn = configurationmanager.connectionstrings["localsqlserver"].connectionstring;
sqldataadapter dap = new sqldataadapter(query1, conn);
dataset ds = new dataset();
dap.fill(ds);
datatable dtlabels = ds.tables[0];
foreach (datarow drow in dtlabels.rows)
{
labels.add(drow["timeframe"].tostring());
}
idata.add(labels.toarray());
return idata.toarray();
}
score:2
i resolved this by creating two classes an populating them. thank you er-sho, your posts help lead me in the right direction.
public class chartdata2
{
public list<string> legends;
public list<int> ad;
}
public class legend
{
public list<string> months;
}
Source: stackoverflow.com
Related Query
- Return List<object> from webservice
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- Chartjs not working with d3 from csv source
- return array from ajax
- Passing an Array from a Flask view to the javascript code of another view
- Using Chart.js onClick function, can you execute code from an undefined or null result?
- Angular6 and ng2-charts does not display any charts when i fill data from webservice
- Calling data from outside of Chartjs code
- Ionic not return data from variable
- How do I use the return values from csv ajax request for x and y values?
- getting additional value fields from data source for dx.chartjs doughnut chart
- How to return two lists to chartjs from Django View
- How pass a variable from code behind to javascript
- How to run Chart.js samples using source code
- Return values from nested array
- How to clear a chart from a canvas so that hover events cannot be triggered?
- Change the Y-axis values from real numbers to integers in Chart.js
- chart.js Failed to create chart: can't acquire context from the given item
- How to remove square label from tooltip and make its information in one line?
- Chartjs random colors for each part of pie chart with data dynamically from database
- How do I prevent the scale labels from being cut off in chartjs?
- How to prevent first/last bars from being cut off in a chart with time scale
- Chart.js Bar Chart - how to chart bars from 0
- Chart from chart.js to pdf
- Get Chart js object from selector
- Hide min and max values from y Axis in Chart.js
- how to change the Y-axis values from float number to integer in chartjs?
- ChartJs how to get from mulitiple dateset which dataset bar is clicked
- How to add datas to chart js from javascript array itself?
- Adding Chart.js line chart to Jinja2/Flask html page from JS file
More Query from same tag
- ChartJS - Highlight Weekends and Lowest and Highest Values
- Show all values in Chart js y axis
- How to get tooltip on chart.js v1.x?
- Chartjs Counting Elements in a Chart
- Chart.JS value on top disappear when tooltip show up
- is there a way to do automatic scrolling?
- react-chart-js-2 keep bar width no matter what the number of bar is
- Implementing Charts.js in Laravel 5.1
- Chartjs defaults deprecation warning
- With Chart js, I am trying to color every 7th vertical (x axis) grid line (representing each week beginning visually)
- How to show values on top of bars in a PDF using chart.js and chartjs-node-canvas?
- javascript chart.js remove last point
- how to pass function variable from one file to another in react
- How to extend chartjs line charts in ReactJS to show solid and dashed line together?
- Chartjs doughnut chart rounded corners for half doghnut
- multiple chartjs charts with the same configuration but different data
- Chart JS Line insert Picture
- Why is this chartjs graph not being loaded? (Using Vue.js)
- Cant pass variable for some reason? PHP
- how to change color of bar if its goes above avg score in mixed graph chart.js
- json file to charts
- Pushing API Data into Chart.js
- How display straight corner in chartjs
- ChartJS Line Graph - Multiple Lines, Show one Value on Tooltip
- Modifying the X-Axis Labels of a Bar chart in Chart.js 2
- How to add a horizontal line at a specific point in chart.js when hovering?
- How can I create a long tail chart with chart.js
- Is there a way to make a view run without having to show the view in the browser in laravel?
- Add Padding Right to Extended Line Chart in Chart.js V2
- How to change position of labels in Doughnut chart?