Giving a solid background color to canvas and display always tooltip values

I need the canvas to looks like this: http://screencast.com/t/cTLppe8E9f6

What do I need:
1- Change the main canvas background color (http://screencast.com/t/WSsE0LZ4g), just the section where the bars are located.

2- I need to enable values into bar graphics always (http://screencast.com/t/6Am7ylZV).

I’ve tried several solutions but they works for old versions of chartjs

I would really appreciate your help on this.

Author: Fantashit

1 thought on “Giving a solid background color to canvas and display always tooltip values

  1. Another option to draw the background is to add a plugin to do this. It will run before the scales are drawn and will not hide them. If you search around on the issues here, you can also find a plugin to label the bars that you could adapt.

    Chart.plugins.register({
      beforeDraw: function(chartInstance, easing) {
        var ctx = chartInstance.chart.ctx,
              chartArea = chartInstance.chartArea;
        ctx.fillStyle = chartInstance.options.backgroundColor; // config option for color
        ctx.fillRect(chartArea.left, chartArea.top, chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);
      }
    });

Comments are closed.