score:0
Accepted answer
in generatedatasetsfromtable(), move your dataset creation outside of the tr loop (rows.each)
function generatedatasetsfromtable()
{
var data;
var datasets = [];
var rows = jquery("tr");
var data = [];
rows.each(function(index){
if (index != 0) // we dont need first row of table
{
var cols = $(this).find("td");
cols.each(function(innerindex){
if (innerindex!=0) // we dont need first columns of the row
data.push($(this).text());
});
}
});
var dataset =
{
fillcolor: "rgba(238,155,0,0.2)",
strokecolor: "rgba(217,0,0,1)",
pointcolor: "rgba(166,0,0,1)",
pointstrokecolor: "#fff",
pointhighlightfill: "#fff",
pointhighlightstroke: "rgba(151,187,205,1)",
data : data
}
datasets.push(dataset);
return datasets;
}
fiddle - http://jsfiddle.net/fv3ry41s/
Source: stackoverflow.com
Related Query
- chartjs table each making series not proceeding to next tr
- how to plot multiple time series in chartjs where each time series has different times
- Chartjs not working with d3 from csv source
- Issue with chartjs linear gradient for the mixed bar chart in ReactJS is not calculated for each individual Bars
- ChartJS not showing data for time series bar chart
- My Chartjs is not updating after setstate full code attached Reactjs Update
- 'require is not defined' error when attempting to use chartjs in javascript code
- Making sure gridlines do not cross y-axis with ChartJS
- Different color for each bar in a bar chart; ChartJS
- Chartjs random colors for each part of pie chart with data dynamically from database
- ReferenceError: Chart is not defined - chartjs
- ChartJs title not showing
- ChartJS canvas not displaying rgba colors in IE, Safari and Firefox
- react-chartjs-2 with chartJs 3: Error "arc" is not a registered element
- TimeSeries scale in ChartJS 3.0.2. brings error "This method is not implemented: either no adapter can be found or an incomplete integration was ..."
- Chartjs displays numbers not time
- show label in tooltip but not in x axis for chartjs line chart
- chartjs + Angular6 is not showing charts or any error
- ChartJS bar chart with legend which corresponds to each bar
- chartjs height does not follow parent container
- ChartJS bar not showing up for simple data points
- How to set a full length background color for each bar in chartjs bar
- ChartJS vertical line not removed on touchend
- Gradient color for each bar in a bar graph using ChartJS
- Series Details Not Showing in Angular Chart with Charts.js
- Chartjs not rendering chart and no error thrown
- ChartJS is not rendered
- Chartjs Data via json request not populating
- Chartjs Graph is not showing in colorbox
- ChartJS set default options only to specific Canvas, not globally
More Query from same tag
- how can i grab a property from an array of JSON objects to use the values of that property as a labels in my chart?
- how to draw Line chart using chart.js and datalabels should be shown
- Change the style of the border in ChartJS
- Use data from SQL database in .js file with PHP
- How to create two pie charts using Chart.js API?
- Changing size of the canvas makes it blurry
- Limit labels number on Chart.js line chart
- Chart.js Bar Chart - grouping and mapping data
- ChartJS – How to show border on empty pie chart?
- Highlight date in Chart.js line graph
- Set xAxes labels to format YYYY-MM-DD HH:mm:ss in Chart.js
- Accessing data from the callback function of a bar chart using chart js
- Django and chart.js - one bar per 'date' in model
- Pie chart.js - display a no data held message
- Have all label in Chartjs be at fixed positions
- Set minimum step size in chart js
- How to have chart.js automatically build x-axis labels based on x,y dataset?
- Display Chartjs tooltip values outside the canvas - multi line chart
- Implementing Data Decimation in vue chartjs
- How to increase right spacing in Chart.js 2.6.0?
- How should i apply date picker in my chart
- Enable Stepped lines in Chart.Js
- json_encode returns "
- Chart.js - Multiple JSON data object array [{x: Date, y: count}....] representing each dataset of the chart
- Charts.js: Using an object to graph
- then function not returning values Angular js
- Bar Graph, chart.js PHP Will Not Load
- Chart Js, Style some ticks on the axis differently
- Chart.js displays the label in a weird font in IE8
- interactive Button doesn't hide the chart as I intended