隐藏 x 轴上的刻度线会剪裁图表 (Chart.JS)
Hiding the ticks on the x-axes clips the chart (Chart.JS)
我试图隐藏气泡图 x 轴上的刻度。
我尝试在报价 属性 内使用 "display: false"。
它确实删除了刻度,但图表现在正在被裁剪。
有没有一种方法可以隐藏这些刻度而不影响图表的外观,或者可以添加一些填充以使图表的外观不受影响?
Appearance before the ticks are removed
Clipping once the ticks are removed with "display: false"
您可以在下面查看我创建的图表的代码:
xAxes : [
{
id : 'first-x-axis',
ticks : {
display : false,
min : < ? php echo $min ? > , // Controls where axis starts
max : < ? php echo $max ? > , // Controls where axis finishes
stepSize : < ? php echo $step ? > // Control the gap between the first x-axis value and the last x-axis value
},
gridLines : {
display : false,
lineWidth : 7 // Width of bottom line
}
}
]
感谢任何帮助或建议^_^
我想通了!
您可以在 "gridlines"
中使用 "tickMarkLength" 调整刻度线的 height/length
您可以在下面查看解决方案的代码:
xAxes: [
{
id: 'first-x-axis',
ticks: {
display: false,
min: <?php echo $min ?>, // Controls where axis starts
max: <?php echo $max ?>, // Controls where axis finishes
stepSize: <?php echo $step ?> // Control the gap between the first x-axis value and the last x-axis value
},
gridLines: {
display: false,
lineWidth: 7,
tickMarkLength: 30// Adjusts the height for the tick marks area
}
}
]
希望对您有所帮助!
我试图隐藏气泡图 x 轴上的刻度。
我尝试在报价 属性 内使用 "display: false"。
它确实删除了刻度,但图表现在正在被裁剪。
有没有一种方法可以隐藏这些刻度而不影响图表的外观,或者可以添加一些填充以使图表的外观不受影响?
Appearance before the ticks are removed
Clipping once the ticks are removed with "display: false"
您可以在下面查看我创建的图表的代码:
xAxes : [
{
id : 'first-x-axis',
ticks : {
display : false,
min : < ? php echo $min ? > , // Controls where axis starts
max : < ? php echo $max ? > , // Controls where axis finishes
stepSize : < ? php echo $step ? > // Control the gap between the first x-axis value and the last x-axis value
},
gridLines : {
display : false,
lineWidth : 7 // Width of bottom line
}
}
]
感谢任何帮助或建议^_^
我想通了!
您可以在 "gridlines"
中使用 "tickMarkLength" 调整刻度线的 height/length您可以在下面查看解决方案的代码:
xAxes: [
{
id: 'first-x-axis',
ticks: {
display: false,
min: <?php echo $min ?>, // Controls where axis starts
max: <?php echo $max ?>, // Controls where axis finishes
stepSize: <?php echo $step ?> // Control the gap between the first x-axis value and the last x-axis value
},
gridLines: {
display: false,
lineWidth: 7,
tickMarkLength: 30// Adjusts the height for the tick marks area
}
}
]
希望对您有所帮助!