user1939481
user1939481

Reputation: 69

Create a label per column using stacked bar chart with groups

is it posible add a label per column on the bottom?

Each dataset is a subset (subactivities) and i want to add the principal activity per column. The black labels (on the bottom) are states and i want to add the principal activity between it and columns

enter image description here

[EDIT]

trying with datalabels plugin:

plugins: {
  legend: { display: true },
  datalabels: {
    labels: {
      name: {
        align: 'top',
        color: 'RED',
        formatter: function(value, ctx) {             
          return value
        },
      },
      value: {
        align: 'bottom',
        formatter: function(value, ctx) {
          return ctx.dataset.stack
        },
        rotation: 0,
      },
    },
  },
},

enter image description here

but, i think i cant write the unique activite by column out of chart, between chart and state legends.

[EDIT 2]

i can show only one activity per column, but o dont know how to show them off the chart

enter image description here

[SOLVED]

value: {
        align: 'bottom',
        anchor: 'start',
        offset: 0,

enter image description here

Upvotes: 2

Views: 390

Answers (0)

Related Questions