【问题标题】:How to remove leftside scales in amcharts如何删除amcharts中的左侧刻度
【发布时间】:2014-05-12 11:10:07
【问题描述】:

如何删除 am-charts 中的侧刻度轴。 例如。在这个小提琴中,我想删除顶部刻度和左侧刻度。 我需要操作哪些属性或方法。

演示图表。 http://jsfiddle.net/JSTQW/

目前,我正在使用此代码来绘制图表:

chart = new AmCharts.AmSerialChart();    
chart.dataProvider = chartData1;   //data provider for chart
chart.categoryField = "year";   //this is the side category year field
chart.startDuration = 1;       //this is the chart plotting time
chart.plotAreaBorderColor = "#ffffff";  //side div rectangular border
chart.plotAreaBorderAlpha = 15;
// this single line makes the chart a bar chart
chart.rotate = true;
chart.columnWidth=0.2;
// AXES
// Category
var categoryAxis = chart.categoryAxis;
categoryAxis.gridPosition = "start";
categoryAxis.gridAlpha = 0.1;
categoryAxis.axisAlpha = 0;

// Value
var valueAxis = new AmCharts.ValueAxis();
valueAxis.axisAlpha = 0;
valueAxis.gridAlpha = 0.1;
valueAxis.position = "top";
valueAxis.maximum = 100;
chart.addValueAxis(valueAxis);

// GRAPHS
// first graph
var graph1 = new AmCharts.AmGraph();
graph1.type = "column";
graph1.title = "Income";
graph1.valueField = "income";
graph1.balloonText = "Income:[[value]]";
graph1.lineAlpha = 0;
graph1.fillColors = "#7fb5b7";
graph1.fillAlphas = 1;
chart.addGraph(graph1);

// second graph
var graph2 = new AmCharts.AmGraph();
graph2.type = "column";
graph2.title = "Expenses";
graph2.valueField = "expenses";
graph2.balloonText = "Expenses:[[value]]";
graph2.lineAlpha = 0;
graph2.fillColors = "#999999";
graph2.fillAlphas = 1;
chart.addGraph(graph2);

// LEGEND
//var legend = new AmCharts.AmLegend();
// chart.addLegend(legend);

chart.creditsPosition = "top-right";

// WRITE
chart.write("chartdiv1");

【问题讨论】:

    标签: amcharts


    【解决方案1】:

    接受的答案对 amcharts4 不再有效,现在您可以这样做:

    valueAxis.renderer.labels.template.disabled = true;
    

    您可能还想禁用工具提示:

    valueAxis.tooltip.disabled = true;
    

    【讨论】:

      【解决方案2】:

      通过设置valueAxis.labelsEnabled 值你可以得到这个。
      试试吧:

      valueAxis.labelsEnabled = false;
      

      【讨论】:

      • 这不再有效
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-23
      • 1970-01-01
      • 1970-01-01
      • 2016-03-20
      • 2014-09-05
      • 2019-03-23
      • 1970-01-01
      相关资源
      最近更新 更多