admin管理员组

文章数量:1429039

Using the Chart.bundle.js script (documentation here), I've created a Line Chart within a object in javascript. Furthermore, my x-axis is numerical, ranging from -100 to 100. It is very important to me that there be a clear distinction between negative and positive numbers, and so I am trying to show a clear, bold x-axis on my Chart object; however, it doesn't seem like Chart.js provides this feature-or perhaps I just cannot find it. Is there any way of making a thicker x-axis? I am open to both conventional solutions as well as hacky ones, if necessary.

Using the Chart.bundle.js script (documentation here), I've created a Line Chart within a object in javascript. Furthermore, my x-axis is numerical, ranging from -100 to 100. It is very important to me that there be a clear distinction between negative and positive numbers, and so I am trying to show a clear, bold x-axis on my Chart object; however, it doesn't seem like Chart.js provides this feature-or perhaps I just cannot find it. Is there any way of making a thicker x-axis? I am open to both conventional solutions as well as hacky ones, if necessary.

Share Improve this question asked Aug 31, 2017 at 22:14 David CDavid C 2133 silver badges8 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

In your options, you can set the lineWidth option:

options: {
   scales: {
      xAxes: [{ 
        gridLines: { lineWidth: 50 },
     }]
  }
}

And the corresponding docs

for x-axis to be more thicker we set in yAxes gridLines this line zeroLineWidth:2
for y-axis to be more thicker we set in xAxes gridlines this line zeroLineWidth:2

documentation:

enter link description here

yAxes: [{           
 gridLines: {
    zeroLineWidth:2
}           
}],
 xAxes: [{
  gridLines: {
    zeroLineWidth:2
 }
}]

本文标签: javascriptThicker XAxis with ChartsjsStack Overflow