LineSeries background color is filled
See original GitHub issueimport 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?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:10 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
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: