Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

How change size label ?

Open ghost opened this issue 10 years ago • 12 comments

Hi,

How can I change the size of labels ?

capture

Thx !

ghost avatar Jun 15 '16 09:06 ghost

use the scaleLabel - fontSize setting http://www.chartjs.org/docs/#scales

options: { scales: { scaleLabel: { fontSize: 16 } } }

D4NH avatar Jun 15 '16 09:06 D4NH

I have try, but doesn't work

var options = { scale: { ticks: { beginAtZero: true, display: false }, scaleLabel: { fontSize:30 } }, legend: false, responsive: true, tooltips: false }

ghost avatar Jun 15 '16 09:06 ghost

try pointLabelFontSize: 20 ?

D4NH avatar Jun 15 '16 10:06 D4NH

See the point label section in http://www.chartjs.org/docs/#scales-radial-linear-scale

etimberg avatar Jun 15 '16 11:06 etimberg

So there is an error in the documentation , it is the sub option pointLabels and not pointLabel

And lineArc is not necessarily false

Point Label Options

The following options are used to configure the point labels that are shown on the perimeter of the scale. They can be found in the pointLabel sub options. Note that these options only apply if lineArc is false.

var e = { scale: { ticks: { beginAtZero: !0, display: !1 }, pointLabels: { fontSize:12 } }, legend: !1, responsive: !0, tooltips: !1 }, o = { labels: ["Analyse", "Programmation", "Communication", "Planification", "Pilotage", "Suivi", "Animation"], datasets: [{ backgroundColor: "rgba(220,220,220,0.2)", borderColor: "#585858", fontSize: 30, defaultFontSize: 30, pointBackgroundColor: "#343434", pointBorderColor: "#fff", pointHoverBackgroundColor: "#fff", pointHoverBorderColor: "#dcdcdc", borderWidth: 2, data: [3, 3, 2, 2, 1.5, 2.5, 1.5] }] }; new Chart($("#radar"), { type: "radar", data: o, options: e })

This work, not with "pointLabel"

ghost avatar Jun 17 '16 13:06 ghost

The following let me change the radial chart axis label font sizes with Chart.js v2.6.0:

options: {
  scale: {
    pointLabels: {
      fontSize: 20,
  },
}

weijiekoh avatar Aug 10 '17 04:08 weijiekoh

It doesn't work in radar chart(

OlegZavrazhin avatar Apr 12 '18 14:04 OlegZavrazhin

@weijiekoh's solution worked for me on radar chart

jrood avatar Apr 09 '19 15:04 jrood

My options:

options: {
  elements:{
    line:{
      tension:0,
      borderWidth:3
    }
  },
  responsive: true,
  legend: {
    position: 'bottom',
    labels: {
      fontSize: 20,
    }
  },
  title: {
    display: false,
    text: 'Rede'
  },
  gridLines: {
    display: false
  },
  scale: {
    ticks: {
      display: false,
      beginAtZero: true
    },
    pointLabels: { fontSize: 20 } ,
    reverse: false
  },
  animation: {
    animateRotate: false,
    animateScale: true
  }
}

caioagiani avatar Oct 30 '20 14:10 caioagiani

This solution does not work on 3.11.2

kungla avatar Apr 04 '22 11:04 kungla

@kungla the above configuration was for CHARTJS v2.

I have tried to change it for version 3 (I didn't test it):

options: {
  responsive: true,
  plugins: {
    legend: {
      position: 'bottom',
      labels: {
        font: {
          size: 20
        }
      }
    },
    title: {
      display: false
    }
  }
  scales: {
    r: {
      beginAtZero: true,
      grid: {
        display: false
      },
      ticks: {
        display: false,
      },
      pointLabels: { 
        font: {
          size: 20 
        }
      }
    }
  }
}

stockiNail avatar Apr 04 '22 11:04 stockiNail

this works. Many thanks.

Rom946 avatar Oct 15 '24 21:10 Rom946