ChartJS 2.0 Rotation

1

How can I rotate the text?

What I have:

I'mtryingtorotatebutctx.translatedoesnotworkright,see:

Here'smycode:

animation:{onComplete:function(){varchartInstance=this.chart;varctx=chartInstance.ctx;ctx.textAlign="center";
                            ctx.font = "bold 25px Arial";
                            ctx.fillStyle = "white";
                            ctx.translate(0,1000);
                            ctx.rotate(-0.5*Math.PI);
                            Chart.helpers.each(this.data.datasets.forEach(function (dataset, i) {
                                var meta = chartInstance.controller.getDatasetMeta(i);
                                Chart.helpers.each(meta.data.forEach(function (bar, index) {
                                    ctx.fillText(dataset.data[index], bar._model.x, bar._model.y - 36);
                                }),this)
                            }),this);
                        }
                    }
    
asked by anonymous 18.07.2016 / 14:27

1 answer

3

Do you really need the caption? For when you hover over each bar, the caption is displayed ... Try inserting this configuration in the script:

 options: { 
         legend: 
                { 
                 display: false 
                } 
          }

This will not be displayed initially, only when you hover over each bar.

    
18.07.2016 / 14:55