Я пытаюсь выровнять легенды на диаграмме с помощью диаграммы. js библиотека
Как я могу выровнять легенды даты диаграммы с помощью диаграммы. js? из этого
![current chart](https://i.stack.imgur.com/Hnb8b.png)
to be like this
введите описание изображения здесь
это код javascript для отображения диаграмм;
var objChart = {
'dates': chartDataSource.liveData.map(function(data){
var parts = data.date.split('-')
return parts[1]+'-'+parts[2]+'-'+parts[0];
}),
'amounts': chartDataSource.liveData.map(function(data){
return data.amount
})
}
var axisWithMinimum = new YAHOO.widget.NumericAxis();
axisWithMinimum.minimum = minY;
axisWithMinimum.labelFunction = "YAHOO.Convio.PC2.Chart.formatCurrency";
console.log(axisWithMinimum)
var myChart = new Chart(ctx,{
type:"line",
data:{
labels:objChart.dates,
datasets:[{
label:'Donated Amount',
data:objChart.amounts,
lineTension: 0,
fill:false,
borderColor:'rgb(0,139,0)',
pointBorderColor: 'rgb(0,139,0)',
pointBackgroundColor: 'white',
pointRadius: 5,
pointHoverRadius: 10,
pointHitRadius: 30,
pointBorderWidth: 2,
pointStyle: 'rectRounded'
}]
},
options:{
tooltips: {
callbacks: {
title:function(){},
label: function(tooltipItem) {
return YAHOO.Convio.PC2.Utils.formatCurrency(tooltipItem.yLabel*100) + " donated on\n" + tooltipItem.xLabel;
}
}
},
scales:{
yAxes:[{
ticks:{
min:0,
callback: function(value, index, values) {
return '$' + value;
}
}
}]
}
}
});
myChart.set( "yAxis", axisWithMinimum );