question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LineSeries background color is filled

See original GitHub issue
import React from "react";
import { render } from "react-dom";
import {XYPlot, XAxis, YAxis, HorizontalGridLines, VerticalGridLines, LineSeries} from 'react-vis';

import "react-table/react-table.css";

var bgColors = { "Default": "#81b71a",
                    "Blue": "#00B1E1",
                    "Cyan": "#37BC9B",
                    "Green": "#8CC152",
                    "Red": "#E9573F",
                    "Yellow": "#F6BB42",
};
class App extends React.Component {
  constructor() {
    super();
    this.state = {
      chartData: [{x: 0, y: 8}, {x: 1, y: 5}, {x: 2, y: 4}, {x: 3, y: 9}, {x: 4, y: 1}, {x: 5, y: 7}, {x: 6, y: 6}, {x: 7, y: 3}, {x: 8, y: 2}, {x: 9, y: 0}]
    };
  }
  render() {
    const { data } = this.state;
    return (
      <div>
        <XYPlot height={70} width={350} style={{backgroundColor: bgColors.Yellow}}>
          <LineSeries color="black" data={this.state.chartData} />
        </XYPlot>
      </div>
    );
  }
}

The top code creates a line-list chart. As I understand it, the background color of this chart should be yellow, but the result is black. Could you please tell me what’s wrong with my code?

1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

24reactions
mcnuttandrewcommented, Mar 24, 2018

Hey @spdhskfmeh It looks like you haven’t imported the style sheet! Go ahead and import the style via including

@import “./node_modules/react-vis/dist/style”;

in your scss file and everything should be fine

9reactions
SimeonCcommented, Apr 19, 2019

The reason for this is that the css applies fill: none;. You “technically” don’t need to import the styling in the original example if you do this it works:

<LineSeries color="black" data={this.state.chartData} style={{ fill: 'none' }} />
Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I set background color of Line Series chart in Flex
I have a Line Series Chart in Flex with values from 0 to 90. I would like to set the background of the...
Read more >
Label background in LineSeries in UI for WPF | Telerik Forums
Hi, I want to change the backgroundcolor for the labels in my lineseries to transparent. I already tried to set the background in...
Read more >
Different background color based on Y-axis in Line series chart
Hi,. I'd like to set the different background color based on Y-axis values in Line Series chart. For example. I'd like to fill....
Read more >
Overriding series' tooltip fill color – amCharts 4 Documentation
Since that will leave us with transparent backgrounds, which we probably don't want, we'll need to set the background for the tooltip's background...
Read more >
Uses of Class com.sencha.gxt.chart.client.draw.Color
Returns the color at the given index. Color, RadarSeries. getFill(). Returns the fill of the line in the series. Color, LineSeries. getFill().
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found