0

I'm trying to increase the line thickness of my Line Chart implemented using react-google-charts. I have went through the documentation but anything related to line thickness did not work. How do i increase the line thickness and give separate colours to the lines. The below is my implementation and approach to increase the line thickness

            <Chart
              width={"98%"}
              height={"290px"}
              chartType="Line"
              loader={<div>Loading Chart</div>}
              data={transformedArray}
              options={{
                lineWidth: 10,
                colors: ["black", "blue", "red", "green", "yellow", "gray"],
                legend: { position: "none" }
              }}
              rootProps={{ "data-testid": "3" }}
            />

lineWidth: 10 did nothing to the lines.

CraZyDroiD
  • 6,622
  • 30
  • 95
  • 182
  • Any online demo? Cause the `lineWidth` should work based on their document – keikai Mar 29 '20 at 05:42
  • I tried this https://codesandbox.io/s/rakannimerreact-google-charts-linechart-no1t7 and it is working too for me. Can you create sandbox? – cauchy Mar 29 '20 at 05:44

1 Answers1

0

In chartType="Line" - lineWidth doesn't work for me as well. But, chartType="LineChart" accepts lineWidth as opion key.

You can play with curveType (line, function) in option config and try to get desired result.

update:

To control colors, use colors property (value is array of colors - as much as you have lines):

colors: ['yellow', 'green']
Community
  • 1
  • 1
Danko
  • 1,819
  • 1
  • 13
  • 12
  • [codesandbox demo](https://codesandbox.io/s/rakannimerreact-google-charts-linechart-4rwef) – Danko Mar 29 '20 at 06:13
  • I used the exact code of your's but still my lineWidth does not change. But i see in the codesandbox example it's working perfectly. I cannot figure out the issue – CraZyDroiD Mar 29 '20 at 14:16
  • Have you changed `chartType="Line"` to `chartType="LineChart"`? I could help you with debugging but will need to see your code example on codesandbox or codepen. – Danko Mar 29 '20 at 14:29
  • Maybe you use some different version of the lib, who knows. Any errors in console? – Danko Mar 29 '20 at 14:30