我将评估4-5个解决方案以在我们的Web应用程序中添加图表。

HighCharts看起来不错,Google Charts也很好,但是对于Google Charts,我找不到如何设置显示哪个vAxis(以及样式)和不设置哪个vAxis的方法。

这是我的选择代码:

    var options = {
        title: '',
        backgroundColor:'#555',
        chartArea: {
            backgroundColor: '#555',
            alignment: 'center',
            }
        },
        legend:{position:'top'},
        vAxis: {
            0: { title: "", logScale: true, maxValue: 1150, minValue: 600, textStyle: {color:'black'} },
            1: { title: "", logScale: true, textPosition: 'none', maxValue: 32, minValue: 30 },
            2: { title: "", logScale: true, textPosition: 'none', maxValue: 2000, minValue: 1000 },
            3: { title: "", logScale: true, textPosition: 'none', maxValue: 5 },
            4: { title: "", logScale: true, textPosition: 'none', maxValue: 5 },
            5: { title: "", logScale: true, textPosition: 'none', maxValue: 5200, minValue: 4200 },
            6: { title: "", logScale: true, textPosition: 'none', maxValue: 14, minValue: 13 },
            7: { title: "", logScale: true, textPosition: 'none', maxValue: 17000, minvalue: 12000 }
            , textStyle: { color: 'orange' }
        },
        hAxis: { title: "", textColor: "#fff" },


所有vAxis的textStyle:{color:'orange'}都可以正常工作。同上,如果我为所有人编写textPosition:“ none”。
但是对于每个vAxis,我无法使textStyle和textPosition工作。在这里,textStyle:{color:'black'}无效(即使我删除了textStyle:{color:'orange'})。

有人遇到过这个问题吗?请问我该如何纠正?

谢谢。

最佳答案

解决方案非常简单,您使用的是vAxis而不是vAxes,这是您需要用于多个vAx的方法。因此正确的用法是:

vAxes: {
        0: { title: "", logScale: true, maxValue: 1150, minValue: 600, textStyle: {color:'black'} },
        1: { title: "", logScale: true, textPosition: 'none', maxValue: 32, minValue: 30 },
        2: { title: "", logScale: true, textPosition: 'none', maxValue: 2000, minValue: 1000 },
        3: { title: "", logScale: true, textPosition: 'none', maxValue: 5 },
        4: { title: "", logScale: true, textPosition: 'none', maxValue: 5 },
        5: { title: "", logScale: true, textPosition: 'none', maxValue: 5200, minValue: 4200 },
        6: { title: "", logScale: true, textPosition: 'none', maxValue: 14, minValue: 13 },
        7: { title: "", logScale: true, textPosition: 'none', maxValue: 17000, minvalue: 12000 }
        , textStyle: { color: 'orange' }
    },

10-06 02:54