如何隐藏分类轴 Y 中的标签
How to hide labels from categoryaxis Y
https://www.amcharts.com/demos/clustered-bar-chart/
我正在使用该图表来表示我在数据库中的值,目前我想从 axisY 中隐藏标签名称,我该怎么做?
var categoryAxis = chart3.yAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "Consultant_Name";
categoryAxis.numberFormatter.numberFormat = "#";
categoryAxis.renderer.inversed = true;
categoryAxis.renderer.grid.template.location = 0;
categoryAxis.renderer.cellStartLocation = 0.1;
categoryAxis.renderer.cellEndLocation = 0.9;
var valueAxis = chart3.xAxes.push(new am4charts.ValueAxis());
valueAxis.renderer.opposite = true;
// Create series
function createSeries(field, name) {
var series = chart3.series.push(new am4charts.ColumnSeries());
series.dataFields.valueX = field;
series.dataFields.categoryY = "Consultant_Name";
series.name = name;
series.columns.template.tooltipText = "Pace: [bold]{valueX}[/]";
series.columns.template.height = am4core.percent(100);
series.sequencedInterpolation = true;
//series.hidden = true;
您可以将 categoryAxis.renderer.labels.template.visible
设置为 false
以隐藏标签:
categoryAxis.renderer.labels.template.visible = false;
Here是显示结果的代码笔
https://www.amcharts.com/demos/clustered-bar-chart/ 我正在使用该图表来表示我在数据库中的值,目前我想从 axisY 中隐藏标签名称,我该怎么做?
var categoryAxis = chart3.yAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "Consultant_Name";
categoryAxis.numberFormatter.numberFormat = "#";
categoryAxis.renderer.inversed = true;
categoryAxis.renderer.grid.template.location = 0;
categoryAxis.renderer.cellStartLocation = 0.1;
categoryAxis.renderer.cellEndLocation = 0.9;
var valueAxis = chart3.xAxes.push(new am4charts.ValueAxis());
valueAxis.renderer.opposite = true;
// Create series
function createSeries(field, name) {
var series = chart3.series.push(new am4charts.ColumnSeries());
series.dataFields.valueX = field;
series.dataFields.categoryY = "Consultant_Name";
series.name = name;
series.columns.template.tooltipText = "Pace: [bold]{valueX}[/]";
series.columns.template.height = am4core.percent(100);
series.sequencedInterpolation = true;
//series.hidden = true;
您可以将 categoryAxis.renderer.labels.template.visible
设置为 false
以隐藏标签:
categoryAxis.renderer.labels.template.visible = false;
Here是显示结果的代码笔