How to add label square to Bar Chart using Chart.js

0👍

There is a fiddle on jsfiddle.net/kaatula/j3FJf/1 that has a similar answer. The code is as follows:

HTML:

<div id="chartContainer" style="width:100%;height: 600px"></div>

JS:

$("#chartContainer").dxChart({
    commonSeriesSettings: {
        label: {
            visible: true
        }
    },
    series: [{
    data: [
        {arg: 0, val: 1},
        {arg: 2, val: 4},    
        {arg: 4, val: 2}]
    }, {
    data: [
        {arg: 1, val: 1},
        {arg: 2.5, val: 9},    
        {arg: 3.7, val: 5.6}]
    }]
});

👍:0

No, that code you provided has NOTHING to do with the small box in the upper right-hand corner. That small boxes in the upper right-hand corner of the jsfiddle are rendered as an SVG (look at the source code) group of two elementary vector graphics. This is indeed a good way to do it, but the code provided above refers to the main graph itself, not the little boxes….
Peter R

Leave a comment