角度:要在图表的条形内显示名称

时间:2019-06-16 06:17:04

标签: javascript typescript angular6 chart.js

我正在使用chartjs显示一些数据。我正在尝试将数据动态添加到数据集数组,但无法正常工作。

使用其他插件:-Legend()插件

this.chart = new Charts  ('LineChart',
    {
    type: 'bar',
    data: {
        labels: this.graphdates,
        // data : this.graphname,


    datasets: [
    {
        label: 'prizemoney',
        data: this.graphprize,


        backgroundColor: "#0000FF",
        value : this.grpdata,
    },
    {
        label: 'Bid Amount',
        data: this.graphbid,
        backgroundColor: "#FF1493",
    }, 


    ],
     plugins: [
        Chartist.plugins.legend()
    ]
},

options: {
     animation: {
      duration: 10,
    },
    plugins: [ legend() ],

    legend: {
        labels: {
            // This more specific font property overrides the global property
            fontColor: 'black',
            series : this.graphname,
        }
    },

      responsive: true,
      maintainAspectRatio: false,

    tooltips: {
      mode: 'label',
      backgroundColor: '#FFF',
      titleFontSize: 16,
      titleFontColor: '#0066ff',
      bodyFontColor: '#000',
      bodyFontSize: 14,
      displayColors: false
     },
    scales: {
      xAxes: [{
        stacked: true,
        barPercentage: 0.6,
        gridLines: { display: false },
        ticks: {
            fontSize: 15
        },
        scaleLabel: {
            display: true,
            labelString: 'Auction Date',
            fontSize: 25,
            fontStyle: "bold",
        },
      }],
      yAxes: [{
        stacked: true,
        ticks: {
            fontSize: 15
        },
        scaleLabel: {
            display: true,
            labelString: 'Amount',
            fontSize: 25,
            fontStyle: "bold",
        }
      }],
    },
    legend: {display: true}
}

});

要在条形图中(即Y轴)显示一些数据。

0 个答案:

没有答案