Tips for eliminating the white border in a stacked column Google chart

Is there a way to eliminate the white border in a stacked column google chart? If anyone has any tips or suggestions, please share!

Here is an example of what I am referring to: my current chart

Answer №1

Utilize a 'style' column role to eliminate white border

To effectively get rid of it, you can use...

stroke-width: 0;

or

stroke-color: transparent;

however, this will expose the background color,
and will appear visually similar on a white background


instead, it is recommended to use the same stroke-color as used for each series

check out the following functional snippet, where a DataView is implemented to insert two 'style' columns

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

function drawChart() {
  var seriesColors = ['#0097A7', '#26C6DA'];

  var data = new google.visualization.DataTable();
  data.addColumn('string', 'x');
  data.addColumn('number', 'y1');
  data.addColumn('number', 'y2');
  data.addRows([
      ['Jan', 10500000, 1500000],
      ['Feb', 4500000, 400000],
      ['Mar', 7000000,800000],
  ]);

  var view = new google.visualization.DataView(data);
  view.setColumns([0, 1, {
      type: 'string',
      role: 'style',
      calc: function (dt, row) {
        return 'stroke-color: ' + seriesColors[0];
      }
    }, 2, {
      type: 'string',
      role: 'style',
      calc: function (dt, row) {
        return 'stroke-color: ' + seriesColors[1];
      }
    }
  ]);

  var options = {
    colors: seriesColors,
    height: 400,
    isStacked: true,
    legend: 'none',
    width: 400
  };

  var container = document.getElementById('chart_div');
  var chart = new google.visualization.ColumnChart(container);
  chart.draw(view, options);
};
<script 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

ways to extract data from a variable using Jquery

Let's say I have a variable named X. X="<table>...</table>" What is the best way to extract data from X using jQuery? For instance: X="<table> <thead> <tr> <td>id</td> <td>name</td> <td>m ...

Change the marquee scrolling back to its original starting point

I am trying to implement a continuous image scroll (marquee) in HTML. My goal is to have the marquee stop scrolling when the mouse hovers over it, with the images returning to their initial position. Once the mouse moves away, I want the marquee to resume ...

Ways to implement a conditional statement to display a div using JavaScript

Looking for a way to utilize Javascript conditions to toggle the visibility of a div in an HTML5 document? Check out this code snippet below: #demo { width: 500px; height: 500px; background-color: lightblue; display: none; } To set the f ...

Is there a more effective method for concealing arrows while scrolling?

I'm attempting to conceal the arrow that appears above the selected header, as depicted below. https://i.stack.imgur.com/wyxdF.png While scrolling, I aim to hide the arrow that appears on the header Company, especially when the first column is sticky ...

Updating a Hidden Field in SharePoint with jQuery

When attempting to set the value of a site column (field) using jQuery, I encountered an issue where it only worked when the field was not hidden. The code I used was: $("select[Title='MyID']").val(MyRelatedID); Upon further inspection, it ...

Using Flexbox to style an h2 heading and a button

I'm diving into React.js and flexbox, trying to center an h2 and a button in a flexbox layout. Despite using justify-content: center, margin: auto, and text-align center, I can't get the formatting right. I know I must be missing something, but I ...

What is the most effective method for manipulating and slicing a string based on character matching?

In this particular scenario, we are dealing with strings that follow this pattern: CP1_ctl05_RCBPAThursdayStartTimePicker_0_dateInput CP1_ctl05_RCBPAFridayStartTimePicker_3_dateInput CP1_ctl05_RCBPAMondayStartTimePicker_1_dateInput The goal is to extract ...

The property 'type' is not found on the 'IntrinsicAttributes & DraggableProps' type in NEXTJS/React

Utilizing @hello-pangea/dnd (a fork of react-beautiful-dnd) to construct a drag and drop list. <Draggable draggableId={section.id} index={index} type="section"> //type <- new/ custom prop However, the 'type' does not exist in ...

Issue with Swiper js autoheight property not adjusting to the height of the first slide

I'm currently using SwiperJs with autoheight functionality. My expectation was that when the slide changes, the container would adjust its height based on the content (simple images in my case). It does update the height on slide change. The issue ar ...

The specified subpath './lib/tokenize' does not match any defined "exports"

As a newcomer to React, I've been facing some challenges while trying to get started. Despite searching on Google and other platforms, I couldn't find a solution to my problem. I was attempting to run code from a YouTube channel called Lama Dev b ...

What is the best way to assign the variable using Firebase data?

Having trouble setting a variable with data retrieved using a get() function on Firebase. export default { name: "customer-navigation", mixins: [navigationMixin], components:{AppSnackBar, authModule,AuthForm}, data () { return { drawer: fa ...

Tips for modifying the _token value in an html form data using ajax

I am currently working on addressing the session expiration issue in my project. I am utilizing ajax to send login formData to the server, built with Laravel 5.4. The form contains a hidden element with the _token value and I have two ajax requests - one t ...

Express functions properly when handling the root route, but encounters issues with sub routes as it sends empty response bodies

Inside the routes.ts file: const router:Router = express.Router() // Route to get all blogs router.get('/',async (req:Request,res:Response)=>{ res.status(200).send("message sent") }) router.get('/admin',async (req:Requ ...

Node package unable to undergo tree shaking process

My node module structure is similar to this: # color.js export var red = '#f00'; export var yellow = '#ff0'; export var blue = '#00f'; # images.js export var image1 = '<base64 string approximately ~ 500kb>&apos ...

Countdown malfunction: wrong date displayed

Utilizing the Countdownjs library in my project is resulting in an incorrect day count. Incorporating AngularJS, here is the custom directive I've implemented for the countdown: .directive('tempoPercorrido', function($interval){ ret ...

I am having difficulty accessing the environment variable stored in my Azure App Service configuration within my REACT application

After setting up my variable in the Azure app service configuration, I attempted to retrieve it from my React project. However, I consistently encountered an 'undefined' value. Azure App Service Configuration Link: https://i.sstatic.net/NextN.p ...

Altering text appearance in a webview

I have implemented this code in my web view. @font-face { font-family: IRANSans; src: url("\file:///android_asset/fonts/IRANSansWeb.ttf\") } body { text-align: justify; direction: rtl; font-family: IRANSans; } img { max-width: 10 ...

Flexbox: Distribute remaining space evenly while allowing content to wrap

Is there a method to instruct flexbox items to occupy the available space while wrapping as soon as they become smaller than their content? However, some items have a fixed width percentage. HTML <div class="grid"> <div class="grid__item"> ...

Should manual ID binding be utilized in backbone.js to establish connections between children and parents?

Currently, I'm developing an application that functions similarly to the Facebook wall feature. The main components are Posts and Comments. While the functionality is in place, I am using code like this within my Post Template to render the CommentV ...

Issue: A malfunction was encountered during the rendering of the Server Components

Whenever I deploy my application to Vercel, I encounter the following error: production An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive detail This issue only manifests on ...