Я пытаюсь отобразить другую ось y на основе нового набора json данных, которые передаются из опций выбора при их нажатии.
Это мой код:
var chartOptions = {
scales: {
xAxes: [{
ticks: {
display: true,
autoSkip: true,
maxTicksLimit: 25
}
}],
yAxes: [{
ticks: {
beginAtZero: false,
// Return an empty string to draw the tick line but hide the tick label
// Return `null` or `undefined` to hide the tick line entirely
userCallback: function (value, index, values) {
if (KpiName === "sales_growth_ytd")
{
return value + '%';
}
else {
value = value.toString();
value = value.split(/(?=(?:...)*$)/);
// console.log($scope.selects);
for(var i = 0; i < $scope.selects.length; i++)
{
if($scope.selects[i].country_name === "Eire")
{
console.log($scope.selects[i].country_name);
return '€' + value;
}
}
for(var i = 0; i < $scope.selects.length; i++)
{
if($scope.selects[i].country_name === "UK")
{
console.log($scope.selects[i].country_name);
return '£' + value;
}
}
}
}
}
}]
},
responsive: true,
options: {
legend: {
labels: {
// This more specific font property overrides the global property
fontSize: 15,
fontStyle: 'bold',
},
animation: {
duration: 1 // general animation time
},
hover: {
animationDuration: 0 // duration of animations when hovering an item
},
responsiveAnimationDuration: 0, // animation duration after a resize
elements: {
line: {
tension: 0 // disables bezier curves
}
},
}
}
};
В зависимости от страны, в которой осуществляется выбор, например, Великобритания или EIRE, я хотел бы отобразить значение со знаком £ или € ось Y.
Как бы я это сделал?
Спасибо