柱形图正在创建其他比例?

时间:2017-10-03 09:50:25

标签: javascript html

我使用谷歌图表创建了自定义柱形图,但是我对vAxis上的比例存在问题。正如你在这个jsFiddle中看到的那样:http://jsfiddle.net/p7o0pjgg/1640/右边有2个刻度?香港专业教育学院到处寻找答案!任何帮助将不胜感激!!

<script type="text/javascript" 
src="https://www.gstatic.com/charts/loader.js"> 
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawStuff);
drawStuff() {
var data = new google.visualization.DataTable();
data.addColumn("string", "Date Range");
data.addColumn("number", "AM");
data.addColumn("number", "PM");
data.addColumn("number", "ETA");
data.addColumn("number", "Under 30 Mins Early");
data.addColumn("number", "Under 60 Mins Early");
data.addColumn("number", "Over 60 Mins Early");
data.addColumn("number", "Under 30 Mins Late");
data.addColumn("number", "Under 60 Mins Late");
data.addColumn("number", "Over 60 Mins Late");
data.addRows([
["Today",123,22,44,66,34,23,55,87,56],
["This Week",123,22,44,66,34,23,55,87,56],
["This Month",123,22,44,66,34,23,55,87,56]
]);
var options = {
    isStacked: true,
    width: 600,
    bar: { groupWidth: "90%" },
    height: 500,
    legend:{textStyle: 
                            {fontSize: 8}
                        },
             vAxis: {
                    viewWindow: {
                            min: 0,
                            max: 300,

                    }
    },
    axisTitlesPosition : "none",
    series: {
        0: {
            targetAxisIndex: 1,
            color: "green"
        }, 
        1: {
            targetAxisIndex: 1,
            color: "purple"
        },
        2: {
            targetAxisIndex: 1,
            color: "brown"
        },
        3: {
            targetAxisIndex: 2,
                            color: "blue"
        }, 
        4: {
            targetAxisIndex: 2,
            color: "#00BFFF"
        },
        5: {
            targetAxisIndex: 2,
            color: "#87cefa"
        },
        6: {
            targetAxisIndex: 3,
            color: "#fa8072"
        },
        7: {
            targetAxisIndex: 3,
            color: "#DC143C"
        },
        8: {
            targetAxisIndex: 3,
            color: "red"
        }
    }
};
var chart = new google.charts.Bar(document.getElementById("chart_div3"));
chart.draw(data, google.charts.Bar.convertOptions(options));

};     
</script>
<div id="chart_div3" style=" width: 700px; height: 600px;"></div>

0 个答案:

没有答案