chartjs / Chart.js

Simple HTML5 Charts using the <canvas> tag
https://www.chartjs.org/
MIT License
64.77k stars 11.92k forks source link

How change size label ? #2779

Closed Cailrorn closed 8 years ago

Cailrorn commented 8 years ago

Hi,

How can I change the size of labels ?

capture

Thx !

D4NH commented 8 years ago

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

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

Cailrorn commented 8 years ago

I have try, but doesn't work

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

D4NH commented 8 years ago

try pointLabelFontSize: 20 ?

etimberg commented 8 years ago

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

Cailrorn commented 8 years ago

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"

weijiekoh commented 7 years ago

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

options: {
  scale: {
    pointLabels: {
      fontSize: 20,
  },
}
OlegZavrazhin commented 6 years ago

It doesn't work in radar chart(

jrood commented 5 years ago

@weijiekoh's solution worked for me on radar chart

caioagiani commented 4 years ago

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
  }
}
kungla commented 2 years ago

This solution does not work on 3.11.2

stockiNail commented 2 years ago

@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 
        }
      }
    }
  }
}
Rom946 commented 4 weeks ago

this works. Many thanks.