簡體   English   中英

Google Charts的錯誤多個vAxis textStyle和textPosition

[英]Bug with Google Charts Multiple vAxis textStyle and textPosition

我將評估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 ,這是您需要用於多個vAxes的方法。 因此正確的用法是:

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' }
    },

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM