score:1
Accepted answer
i found this, hereby a complete working fiddle to show you how it can be done: http://jsfiddle.net/nc37x/1345/
google.load('visualization', '1', {packages: ['corechart']});
google.setonloadcallback(drawvisualization);
function drawvisualization() {
// example copied from google visualization api playground,
// modified for category axis annotations
// create and populate the data table.
var data = new google.visualization.datatable();
data.addcolumn('string', 'x');
data.addcolumn({type: 'string', role: 'annotation'});
data.addcolumn({type: 'string', role: 'annotationtext'});
data.addcolumn('number', 'cats');
data.addcolumn('number', 'blanket 1');
data.addrow(["a", null, null, 1, 1, ]);
data.addrow(["b", null, null, 2, 0.5]);
data.addrow(["c", null, null, 4, 1]);
data.addrow(["d", null, null, 8, 0.5]);
data.addrow(["e", null, null, 7, 1]);
data.addrow(["f", null, null, 7, 0.5]);
data.addrow(["g", 'foo', 'foo annotation', 8, 1]);
data.addrow(["h", null, null, 4, 0.5]);
data.addrow(["i", null, null, 2, 1]);
data.addrow(["j", null, null, 3.5, 0.5]);
data.addrow(["k", 'bar', 'bar annotation', 3, 1]);
data.addrow(["l", null, null, 3.5, 0.5]);
data.addrow(["m", null, null, 1, 1]);
data.addrow(["n", null, null, 1, 0.5]);
// create and draw the visualization.
new google.visualization.linechart(document.getelementbyid('visualization')).
draw(data, {
curvetype: 'function',
width: 500,
height: 400,
vaxis: {
maxvalue: 10
},
annotations: {
style: 'line'
}
});
}
Source: stackoverflow.com
Related Query
- How to draw vertical axis in google charts
- How to align vertical axis area on two charts in chart.js
- How do I draw a vertical line on a horizontal bar chart with ChartJS?
- How to use chart.js script to draw multiple pie Charts
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- Chart.js - Draw charts with opposite bars - How to set both the y-axis ends to positive number?
- ChartJS / Chartjs-plugin-annotation How to draw multiple vertical lines using an array?
- How to draw multiple line on y axis for same x axis in chartjs v2?
- How to draw a range label on x axis using chartJS
- How to create a graph where the vertical axis (Y-axis) is a string?
- How to set 3 axis in google chart (V-Axis Left as Qty, V-Axis Right as Series Column and H-Axis as TimeOrder)?
- How to add left padding for my charts done in ChartJs and my Google Map so it is not glued to the limit of the page on the left
- angular 7 how to draw dynamic number of charts
- how to draw dotted line vertical line at 0 postiion in highChart
- I am using chart js to draw a chart. I did everything right but i don't know why the x axis and y axis label is not comming in chart. code below
- How to run Chart.js samples using source code
- How to draw x axis and y-axis origin line draw in ng2-google-charts?
- How to add axis titles in chart.js charts
- how to not repeat code while creating multiple charts in chart js
- How to set max and min value for Y axis
- How to set ChartJS Y axis title?
- How to hide y axis line in ChartJs?
- How to modify bar width in Chartjs 2 bar charts
- ChartJS: How to set fixed Y axis max and min
- Charts JS: How to set units?
- How to drill down charts with ChartJS?
- How to save Chart JS charts as image without black background using blobs and filesaver?
- How to Draw Gantt chart using chart js or other libraries
- How to remove the line/rule of an axis in Chart.js?
- How can I draw dotted line using chartjs?
More Query from same tag
- stepsize x-axe with time string labels
- How to update only new data in Chart.JS?
- Chart.js 2 - Axis Layer Padding
- Chart.js v3: how to allow tick label overflow?
- How to reduce the number of points shown on line chartjs chart with a large dataset?
- how to remove old data from Chart js on mouse hover using mvc c#?
- Unable to change default values in chart.js
- How to change number to $ with commas? Chart.js
- [MIXED CHART.JS]How do I manipulate the label of each chart's tooltips?
- Chartjs - data format for bar chart with multi-level x-axes
- How to display average line in chart.js
- Chart JS: is possible mix Scatter and bar chart in Chart JS?
- angular-chart add horizontal line
- How do I change axis, title, legend formatting on chartjs template
- How to ensure that a Chart.js line chart uses all space available on the y-axis?
- manipulate objects from inside a function
- Dynamic multiple charts in chart.js with dynamic data inside them
- Remove excess lines on y axis using chartjs
- White space at start and end of data with time scale in chart.js
- chart.js, after each update, avoid scrolling to top position
- Draw a single frame in Chart.js
- How do you output the correct value for Chart.js Radar graph on label?
- Chart.js, PHP and JSON loop issue
- Chart.js Chart in Angular does not load until resizing browser window
- pie chart label undefined ionic 3
- How get sum of total values in stackedBar ChartJs
- ChartJS and JSON result: Cannot set property 'fillColor' of undefined
- ChartJS - Help me custom tooltip
- how to set title in legend of chart.js?
- Vue-Chartjs not rendering graph