Skip to content Skip to sidebar Skip to footer

Angular Charts With Some Especial Requirements

I am using Angular Charts in order to achieve what I want, yesterday I did it, but now my client wants some changes, here is the data I am receiving: { '12-15-2015': { '55f6d

Solution 1:

Remove the total from the chars is as simple as removing the "total" from the seriesConv array. But since it's now only one serie, it can be simpler:

.then(function(data) {          
  $scope.labels = Object.keys(data);
  $scope.seriesConv = ["Amount"];
  $scope.dataConv = [$scope.labels.map(function(label) {
    $scope.trafficSource = Object.keys(data[label])[0];
    return data[label][$scope.trafficSource].conversions.amount;
  })];
}

To use a custom format inside the tooltip you can use the tooltipTemplate option from Chart.js:

$scope.chartOptions = {
  tooltipTemplate: "$<%= value %>",
};

Then add chart-options="chartOptions" to the canvas element.

Note that it's only possible to edit the existing label, you can't add new data to the tooltip (the total for example).

To be able to add new data you'll have to use the (much complex) customTooltips option. Good luck with that.

Also, please read the docs and try playing around. This forum is for question about programming, not for asking the others to do your job.

Post a Comment for "Angular Charts With Some Especial Requirements"