How to have solid colored bars in angular-chart bar chart

后端 未结 4 547
南旧
南旧 2020-12-20 22:34

I\'m using angular-chart (based on chart.js) to create some bar charts and am having trouble getting the bar styling I want. I want the bars to be solid colors like this:

4条回答
  •  再見小時候
    2020-12-20 22:56

    Here are the codes that I have made to make a bar chart with custom settings. Use this attribute chart-dataset-override="datasetOverride" in the canvas html tag:

    
    
    
    
    var setGraphDate = function () {
        var xData = [];
        var yData = [];
        $scope.Data.ExpenseRecords.forEach(function (g) {
            yData.push(g.PercentOfCompletion);
            xData.push(g.TspShortName);
        });
        $scope.datasetOverride =
        {
            backgroundColor: "#4E4EFF",
            borderColor: "#2E2E99"
        };
        $scope.labels = xData;
        $scope.expenseData = yData;
        $scope.series = ['Expense Graph'];
       // more options
        $scope.chartOptions = {
    
            legend: {
                display: false
            },
    
            },
            title: {
                display: true,
                text: 'TSP Burn Rate'
            },
            events: false,
            tooltips: {
                enabled: false
            },
            hover: {
                animationDuration: 0
            }
    };
    

提交回复
热议问题