Getting rid of the horizontal white line that separates Google stacked column charts

Is there a way to eliminate the horizontal white lines that appear between the columns in this stacked chart?

https://i.sstatic.net/ZEBIM.png

This is the code I am working with:

<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">

google.charts.load('current', {'packages':['corechart']});

google.charts.setOnLoadCallback(drawChart);

function drawChart() {
    var data = google.visualization.arrayToDataTable([
        ['Genre', 'One', 'Two'],
        ['2010', 10, 24],
        ['2020', 16, 22]
    ]);

    var options = {
        width: 300,
        height: 200,
        legend: 'none',
        bar: { groupWidth: '100%' },
        isStacked: true,
        series: { 
            0: { color: '#40a1ec' }, 
            1: { color: '#ff8888'} 
        },          
    };

    var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));

    chart.draw(data, options);
}
</script>
</head>

<body>
<div id="chart_div"></div>
</body>
</html>

I have been able to remove the vertical white space between bars using groupWidth, but I am struggling to get rid of the horizontal white lines.

Any suggestions would be greatly appreciated. Thank you!

Answer №1

One solution is to apply CSS styles to the columns to ensure stroke values are not null:

google.charts.load('current', {
  'packages': ['corechart']
});

google.charts.setOnLoadCallback(drawChart);

function drawChart() {
  var data = google.visualization.arrayToDataTable([
    ['Genre', 'One', { role: 'style' }, 'Two', { role: 'style' } ],
    ['2010', 10,  'stroke-width: 1;stroke-color: blue;', 24,'stroke-width: 1;stroke-color: red;'],
    ['2020', 16, 'stroke-width: 1;stroke-color: blue;', 22, 'stroke-width: 1;stroke-color: red;']
  ]);
  var options = {
    width: 400,
    height: 400,
    legend: 'none',
    bar: {
      groupWidth: '100%'
    },
    isStacked: true,
    series: {
      0: {color: '#40a1ec'},
      1: {color: '#ff8888'}
    }
  };
  var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
  chart.draw(data, options);
}
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>

<div id="chart_div">
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having difficulty retrieving the Area and Range information in ChartJS

I am new to working with HTML5 and ChartJS. I have noticed two different types of declarations when attaching JS Chart Versions 1.0.1 and 2.1.1. Can you please provide some insight into this? Additionally, I am facing an issue where the stripes behind the ...

What is the best approach for presenting MySQL data on an HTML div through Node.js?

When working with Node.js, I prefer using Express as my framework. Here is the AJAX code I have on my member.ejs page: function load_member(){ $.ajax({ url: '/load_member', success: function(r){ console.lo ...

navigating a pointer graphic within a container

I've been working on creating a sniper game, but I've run into an issue with moving the sniper image inside the div. My main objective is to change the image to the sniper image when the mouse hovers over the div. Here's what I have tried so ...

Having trouble with JavaScript/JQuery not functioning properly in HTML content loaded using the load() method

My goal is to load an input form from a separate file called new_machine.php into my index.php. This form includes an input with a dropdown that retrieves options from a MySQL database and displays them as anchors. The issue arises when I attempt to manipu ...

Utilize jQuery to refresh the database with the information retrieved from the ajax-request

I am attempting to update the database. This is what I am doing From my JavaScript code var data = { "jobid": $('#jobid').val(), "names": $('#names').val(), "scripttype": $('#testscripts').val() }; var msg=""; f ...

Is it possible to transform a webpack configuration into a Next.js configuration?

i have come across a webpack configuration setup from https://github.com/shellscape/webpack-plugin-serve/blob/master/recipes/watch-static-content.md: const sane = require('sane'); const { WebpackPluginServe: Serve } = require('webpack-plugin ...

The Art of Capturing Sound: Unleashing

Currently, I am attempting to capture video via html5 .getUserMedia and play it back without needing to upload it to a server. Despite following numerous tutorials, I have only been successful on Chrome by utilizing canvas to draw the webp image and then c ...

Is there a way to access an element by its ID using document.re

Having recently delved into the worlds of Javascript and php, I find myself struggling with a form on my website that utilizes php processes. After this, I perform a check in my database to verify the existence of login credentials. In cases where they are ...

Creating a blueprint for inserting a new data entry

When adding a record with minimal user-required information, it is important to consider the user experience. Instead of directing the user to a blank "edit" page, a more seamless approach can be taken. One option is to have the user click on something th ...

Determine a deeper hue using Javascript

Is there a way to adjust this calculation to achieve a darker color rather than a brighter one? function increase_brightness(hex, percent){ // strip the leading # if it's there hex = hex.replace(/^\s*#|\s*$/g, ''); // ...

How to access a Selenium element using JavaScriptExecutor

My task involves working with a collection of elements in Selenium, specifically located using the By.CssSelector method: var contentRows = new List<TableRow>(); for (var i = 1; i < PositiveInfinity; i++) { var cssSelectorToFind = $"tbody &g ...

Having trouble getting Visual Studio Code to execute my build command in launch.json

Whenever I run this specific command in a command prompt, everything works perfectly: browserify -u jquery /public/index.js -t babelify -o /public/scripts/bundle.js & node /server.js But when attempting to integrate it into the program section of my ...

Hide image URL on mobile devices with CSS and JavaScript

Exploring the realm of cross-device magic, I have a challenge on my hands. My goal is to eliminate a slider image for screen widths smaller than 622px. Through experimentation, I have discovered that removing the image URL in CSS achieves the desired effec ...

Is it logical to combine Require.js and Angular.js for web development purposes?

As someone new to Angular.js, I am exploring how it differs from Backbone.js. Previously, we utilized Require.js to handle our package dependencies with Backbone. Is it advisable to follow the same approach with Angular.js? ...

Finding mongoose in an array of objects nested within another object

Here is the MongoDB JSON document I am working with: { categoryId: '1', categoryName: 'Outdoors Equipments', items: [ { itemId: '1', itemName: 'Camping T ...

Top tips for maintaining timer functionality in a Progressive Web App

I'm in the process of developing a progressive web app with React that centers around maintaining a running timer. Just to provide some background, this app is designed for home-brewers who want to keep track of when certain ingredients like hops n ...

At what point does angular2 @output get resolved?

Click on this link Here is the HTML code snippet: <chart [options]="options" (load)="saveGraphInstance($event.context)"></chart> <div (click)="switchGraph()">switch</div> <div (click)="showLoadingForce()">show loadin ...

Tips for showing just the value, not the key, following JSON.stringify:

I'm facing an issue where I need to extract the value of a specific key from a JSON object obtained after using JSON.stringify on form data. The current JSON object that I have looks like this: {"KEY":"KM8IJM12D56U303366"} Here& ...

A guide on utilizing the Check All feature in nglightning for Angular 2

Is there a feature available in nglightning that allows users to check all records in a datatable? You can find the component at the following link: I am specifically looking for the ability to check all checkboxes in nglightning within the header row. Is ...

"Displaying 'undefined' in an array of objects during the ngOnInit lifecycle hook in Angular 5

When attempting to access the HTML content, no value is being returned <mat-nav-list> <a mat-list-item href="" *ngFor="let link of products"> {{ link.name }} </a> </mat-nav-list> Below is the JSON data: [{"id":215,"nam ...