javascript - How to set up a custom template on Chartjs? -


i working line chart chartjs , the angular extension plugin.

i having difficulties trying edit tooltip according docs need create custom template in order achieve need

here have far

enter image description here

as see there tooltip not displaying need, need display this:

$amount (total)

so in case should be:

$150 (1)

got ?

see code

      $scope.labels = object.keys(data);       $scope.seriesconv = ["amount"];       $scope.dataconv = $scope.seriesconv.map(function(serie) {         return $scope.labels.map(function(label) {           $scope.trafficsource = object.keys(data[label])[0];           $scope.chartoptions = {             tooltiptemplate: "<%= '$' + value %>",           };           return data[label][$scope.trafficsource].conversions.amount;         });       }); 

and html

   <canvas id="line" class="chart chart-line"            height="100" chart-options="chartoptions"            chart-data="dataconv" chart-labels="labels">    </canvas> 

this data receiving

{   "12-15-2015": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 8,         "real": 1       }     }   },   "12-16-2015": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 18,         "real": 1       }     }   },   "12-17-2015": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 1,         "amount": 22       },       "clicks": {         "total": 12,         "real": 1       }     }   },   "12-18-2015": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 6,         "real": 1       }     }   },   "12-19-2015": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 12,         "real": 1       }     }   },   "12-20-2015": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 10,         "real": 1       }     }   },   "12-21-2015": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 1,         "amount": 22       },       "clicks": {         "total": 1,         "real": 1       }     }   },   "12-22-2015": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 1,         "amount": 150       },       "clicks": {         "total": 1,         "real": 1       }     }   },   "12-26-2015": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 4,         "real": 1       }     }   },   "12-28-2015": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 1,         "real": 1       }     }   },   "12-29-2015": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 1,         "real": 1       }     }   },   "01-03-2016": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 2,         "real": 1       }     }   },   "01-04-2016": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 3,         "real": 1       }     }   },   "01-05-2016": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 6,         "real": 1       }     }   },   "01-06-2016": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 6,         "real": 1       }     }   },   "01-10-2016": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 1,         "real": 1       }     }   },   "01-11-2016": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 2,         "real": 1       }     }   },   "01-14-2016": {     "55f6de98f0a50c25f7be4db0": {       "conversions": {         "total": 0,         "amount": 0       },       "clicks": {         "total": 22,         "real": 1       }     }   } } 

for playing "conversions : {} part of object, contains total , amount

so according docs of links, think should in order achieve want?


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -