Reputation: 2201
I'm using json data from jira to render a project's burndown chart. For reasons I won't go into, I can't use the built-in Jira Agile charts. I'm using chartist.js to render the burndown but I'm running into troubles and would appreciate a chartist.js user's input.
I've attached an image of the chart I want to generate as a reference.
I've been enjoying using chartist.js, but I'm not married to it for my project, I can use any chart library I want. I would gladly accept suggestions for another charting library that does what I need it to.
Upvotes: 1
Views: 1850
Reputation: 1423
Although Chartist does not directly support a convenient API for creating time based charts (this will land very soon), we have added dynamic axis configuration which allows you to switch the standard X axis type (step based) to a more sophisticated scale axis.
As Dates will be converted to numbers and the math behind the scene is the same, you can very easily create time based charts with a bit of manual work. We have no tick generator based on time frames as of yet but again this will come with the TimeAxis that will be created very soon in Chartist.
To get more information on the custom axis configuration you can read the docs here: http://gionkunz.github.io/chartist-js/getting-started.html#switching-axis-type
To show you and others how easy it would be to implement a burndown chart I've created one for you with Chartist 0.9.1. I'm using moment.js to format the dates.
Here is the jsbin: http://jsbin.com/lokozu/edit?html,js,output
var chart = new Chartist.Line('.ct-chart', {
series: [{
name: 'remaining',
data: [
{x: new Date(143134652600), y: 53},
{x: new Date(143334652600), y: 40},
{x: new Date(143354652600), y: 45},
{x: new Date(143356652600), y: 41},
{x: new Date(143366652600), y: 40},
{x: new Date(143368652600), y: 38},
{x: new Date(143378652600), y: 34},
{x: new Date(143568652600), y: 32},
{x: new Date(143569652600), y: 18},
{x: new Date(143579652600), y: 11}
]
}, {
name: 'stories',
data: [
{x: new Date(143134652600), y: 53},
{x: new Date(143334652600), y: 30},
{x: new Date(143384652600), y: 30},
{x: new Date(143568652600), y: 10}
]
}]
}, {
axisX: {
type: Chartist.FixedScaleAxis,
divisor: 5,
labelInterpolationFnc: function(value) {
return moment(value).format('MMM D');
}
},
axisY: {
onlyInteger: true,
low: 0
},
series: {
remaining: {
lineSmooth: Chartist.Interpolation.step(),
showPoint: false
},
stories: {
lineSmooth: false
}
}
});
Upvotes: 2