小编Rac*_*ack的帖子

编辑Chart.js图例模板

我正在使用chart.js开展项目.我想以雷达图表的形式显示数据.我们有5种不同的数据源.为了使我们的雷达图表更具可读性,我们将这些数据源中的一部分划分了(其中一些数据源的值比其他数据源高得多),我们的图表看起来很好.

但是现在唯一的问题是,在我们的图例中,数据显示为小数位(因为我们已将其划分).

有谁知道如何编辑chart.js中的图例模板,以便我们可以将显示的结果与我们的某些数据集相乘(这样用户看不到小数点数据)?

这个函数在我们的app.js文件中创建了chart.js的数据集(注意一些值被划分):

  return largestStations.reduce(function(previousValue, currentValue, index, array) {
previousValue.datasets[index] = {
  label: currentValue.commonName.replace(' Underground Station', ''),
  // add chart formatting (needs to be made dynamic)
  fillColor: "rgba(255, 0, 0, 0.2)",
  strokeColor: "rgba(255, 0, 0, 1)",
  pointColor: "rgba(255, 0, 0, 1)",
  pointStrokeColor: "#fff",
  pointHighlightFill: "#fff",
  pointHighlightStroke: "rgba(220,220,220,1)",
  // end of chart formatting
  data: [
    app.getValueFromStation(currentValue, 'Gates') / 10,
    app.getValueFromStation(currentValue, 'Lifts'),
    app.getValueFromStation(currentValue, 'Payphones'),
    app.getValueFromStation(currentValue, 'Escalators') / 3,
    app.getValueFromStation(currentValue, 'Cash Machines')
  ]
};
return previousValue; }
Run Code Online (Sandbox Code Playgroud)

我们目前正在使用chart.js中的默认图例模板,如下所示:

<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var …
Run Code Online (Sandbox Code Playgroud)

chart.js

7
推荐指数
1
解决办法
733
查看次数

添加一个www. GithubPages 的子域

我希望www.username.github.io重定向到username.github.io

\n\n

我已阅读文档,并创建了一个 CNAME 文件来定向到 www.username.github.io,但它不起作用。(用户名.github.io 正在运行)

\n\n

我已经运行了 dig 命令来检查状态(按照文档中的建议),它返回 www.username.github.io (不工作)和 username.github.io (工作)的类似结果

\n\n
\xe2\x9e\x9c  ~  dig username.github.io  \n; <<>> DiG 9.8.3-P1 <<>> username.github.io.\n;; global options: +cmd\n;; Got answer:\n;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2627\n;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0\n\n;; QUESTION SECTION:\n;username.github.io.        IN  A\n\n;; ANSWER SECTION:\nusername.github.io. 600 IN  CNAME   github.map.fastly.net.\ngithub.map.fastly.net.  15  IN  A   185.31.18.133\n
Run Code Online (Sandbox Code Playgroud)\n\n

对于 www.usernam.github.io

\n\n
\xe2\x9e\x9c  ~  dig www.username.github.io                        \n\n; <<>> DiG 9.8.3-P1 …
Run Code Online (Sandbox Code Playgroud)

subdomain url github

6
推荐指数
1
解决办法
128
查看次数

标签 统计

chart.js ×1

github ×1

subdomain ×1

url ×1