如何在Chartist.JS中向标签添加逗号

问题描述 投票:0回答:1

我有以下图表:Chart missing comma

我想在Y标签上添加逗号,但是似乎没有任何效果。我已经尝试了来自社区such as this one的一系列答案,但是没有任何变化。也许是由于版本差异造成的?我的完整图表代码如下:

<div class="ct-chart ct-major-eleventh graph"></div>

<script>
    new Chartist.Line('.ct-chart', {
      labels: {{ chart_labels }},
      series: [{{ chart_values }}, {{ chart_values }} ]
    }, {
        low: {{ chart_low }},
        showArea: true,
        axisX: {
            labelInterpolationFnc: function skipLabels(value, index) {
                return index % 3  === 0 ? value : null;
            }
        },
        ticks: {
            beginAtZero: true,
            callback: function(label, index, labels) {
                return Intl.NumberFormat('hi', { style: 'currency', currency: 'USD', minimumFractionDigits: 2 }  )
                .format(label).replace(/^(\D+)/, '$1 ');
            },
        }
    });
</script>
javascript chartist.js
1个回答
0
投票

我也在同一条船上!但是,我的问题涉及x轴上的日期。如果我在初始数据中添加逗号,那么图表管理员会将其视为定界符,并且图形将全部变脏,无论我将其括在单引号还是双引号中。回调似乎也对我深蹲(因为它根本不会更改数据)。我以为也许有办法更改使用的定界符就可以了,但我找不到与定界符和图表专家有关的任何东西。我在制图师github问题队列上添加了一个问题:https://github.com/gionkunz/chartist-js/issues/1227

© www.soinside.com 2019 - 2024. All rights reserved.