Skip to content

Instantly share code, notes, and snippets.

@typpo
Last active February 18, 2020 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typpo/f7ada53b1d2a3bf2ed0f1ff7446fc6f5 to your computer and use it in GitHub Desktop.
Save typpo/f7ada53b1d2a3bf2ed0f1ff7446fc6f5 to your computer and use it in GitHub Desktop.
Chart.js example
{
"type": "line",
"data": {
"labels": [ "", "", "", "", "", "", "", "" ],
"datasets": [
{
"label": "comments",
"borderColor": "blue",
"yAxisID": "A",
"data": [ 0, 1, 1, 1, 2, 3, 4, 4 ],
"fill": false,
"borderWidth": 1
},
{
"label": "retweets",
"borderColor": "green",
"backgroundColor": "#ff8c00",
"pointBorderColor": "#ff8c00",
"yAxisID": "B",
"data": [ 80, 261, 357, 475, 501, 514, 527, 535 ],
"pointRadius": [ 0, 0, 5, 0, 0, 0, 0, 0 ],
"fill": false,
"borderWidth": 1
}
]
},
"options": {
"legend": {
"position": "right",
"labels": {
"boxWidth": 5,
"fontSize": 8,
"padding": 5
}
},
"layout": {
"padding": {
"bottom": -20
}
},
"elements": {
"point": {
"radius": 0
}
},
"scales": {
"xAxes": [
{
"gridLines": {
"color": "transparent"
}
}
],
"yAxes": [
{
"id": "A",
"position": "left",
"gridLines": {
"color": "transparent",
"tickMarkLength": 5
},
"ticks": {
"min": 0,
"max": 6,
"maxTicksLimit": 1,
"precision": 0,
"fontSize": 8,
"fontColor": "blue",
}
},
{
"id": "B",
"position": "right",
"gridLines": {
"color": "transparent",
"tickMarkLength": 5
},
"ticks": {
"min": 0,
"max": 535,
"maxTicksLimit": 1,
"fontSize": 8,
"fontColor": "green",
}
}
]
},
"annotation": {
"annotations": [
{
"type": "box",
"yScaleID": "A",
"yMin": 0,
"yMax": 3,
"backgroundColor": "#E0E0FF66",
"borderColor": "transparent"
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment