如何在amCharts中水平显示y轴标题?

时间:2015-08-25 12:54:27

标签: javascript charts axis amcharts

任何人都可以帮我水平显示Y轴的标题吗?此外,我希望图形占据整个X轴(整个X轴)。以下是我正在使用的代码:

function createXYZchart() {
    var chart = new AmCharts.AmSerialChart();
    chart.dataProvider = dataXYZ; //data source
    chart.categoryField = "month"; //data provider X-Axis

    var categoryAxis = chart.categoryAxis;
    categoryAxis.labelRotation = 90;
    chart.angle = 60;
    chart.depth3D = 5;
    chart.columnWidth = 0.85;

    var valueAxis = new AmCharts.ValueAxis();
    valueAxis.dashLength = 10;
    valueAxis.autoGridCount = false;
    valueAxis.minimum = 90;
    valueAxis.maximum = 100;
    valueAxis.gridCount=5;
    valueAxis.labelFunction = formatLabel;
    chart.addValueAxis(valueAxis);
}

1 个答案:

答案 0 :(得分:0)

要使垂直值轴标题水平显示,请使用其titleRotation属性:(将其设置为0 - 或零旋转)

valueAxis.title = "Y axis";
valueAxis.titleRotation = 0;

要使图表扩展绘图区域的整个宽度,请将categoryAxis上的startOnAxis设置为true

categoryAxis.startOnAxis = true;