Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 使用角度图表和CoffeeScript格式化图表标签_Angularjs_Coffeescript_Chartist.js_Angular Chartist.js - Fatal编程技术网

Angularjs 使用角度图表和CoffeeScript格式化图表标签

Angularjs 使用角度图表和CoffeeScript格式化图表标签,angularjs,coffeescript,chartist.js,angular-chartist.js,Angularjs,Coffeescript,Chartist.js,Angular Chartist.js,我正在尝试将我的标签格式化为百分比。我曾尝试查看Chartist.js的文档并将其转换为CoffeeScript,问题是,由于我们使用的是Angular,因此使用的是Angular Chartist模块,所以我并不十分清楚。这是一个相当琐碎的部分,我不能要求我的联合创始人花时间在上面,因为在我们的项目中有许多更大的部分在起作用,但我想知道我的不足之处 图表是使用ChartList指令显示的(我猜这是angular ChartList的一部分): 这是我尝试获取选项的coffeescript(请

我正在尝试将我的标签格式化为百分比。我曾尝试查看Chartist.js的文档并将其转换为CoffeeScript,问题是,由于我们使用的是Angular,因此使用的是
Angular Chartist
模块,所以我并不十分清楚。这是一个相当琐碎的部分,我不能要求我的联合创始人花时间在上面,因为在我们的项目中有许多更大的部分在起作用,但我想知道我的不足之处

图表是使用ChartList指令显示的(我猜这是
angular ChartList
的一部分):

这是我尝试获取选项的coffeescript(请注意,labels和series属性工作正常;但是ChartList元素没有拾取
barResponsiveOptions
属性(因此,
console.log
调试行没有触发):


现在,图表显示时y轴上的数据点为1的分数(例如,0.0->1.0)。

如果您没有使用此处说明的响应选项,则应使用
图表列表选项
属性作为常规选项和
图表列表响应选项

干杯

  # Organize return data into labels and series for Chartist
  typeCounts = ResultService.getTypeCounts()
  $scope.typeCounts.labels = Object.keys(typeCounts)
  $scope.typeCounts.series = [typeCounts[type] for type in Object.keys(typeCounts)]
  $scope.typeCounts.barResponsiveOptions = [
    axisY:
      labelInterpolationFnc: (value) ->
        console.log("Firing barResponsiveOptions")
        Math.round(value * 100) + '%'
  ]