简体   繁体   中英

how to remove the y-axis line and format the value of the y-axis in google column chart

Im using google column chart in my application in my chart i need to remove the tiny space between my blue and grey bars and also to format the y axis values. Please suggest me, how to remove that tiny gap between them. My Chart 在此输入图像描述

Code for the chart

google.load("visualization", "1", {packages: ["columnchart"]});                
var datum=[];
                        datum=[[2,15,25]];
var data = google.visualization.arrayToDataTable([['column1', 'column2', 'column3']].concat(datum), false);
                            var options = {
                            legend: {position: 'none'},
                            colors: ['3399FF', 'C0C0C0'],
                            tooltip: {trigger: 'none'},
//                            vAxis: {minValue: 0, maxValue: maxValue, ticks: tick, format: '$'}
                            };
                                    var chart = new google.visualization.ColumnChart(document.getElementById('chart'));
                            chart.draw(data, options);

Updated

How to remove the yaxis line and need to format the y axis value like $10, $15, $30. Is there any way to do that in column chart package. The link i'have refered to do the chart is this

You can add the following to your options object: bar: {groupWidth: '100%'} .

This will remove the gap between your gray and your blue bar.

All options are also listed in the documentation .

First off, don't use the old version of the ColumnChart; it is deprecated and doesn't offer any features that the newer version doesn't also have. Load it like this:

google.load('visualization', '1', {packages: ['corechart']});

To format the axis values, you need to use the vAxis.format option:

var options = {
    legend: {position: 'none'},
    colors: ['3399FF', 'C0C0C0'],
    tooltip: {trigger: 'none'},
    vAxis: {
        format: '$#'
    }
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM