Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to customize strokeColor for LineChart? #174

Open
aalokt89 opened this issue Oct 21, 2019 · 1 comment
Open

How to customize strokeColor for LineChart? #174

aalokt89 opened this issue Oct 21, 2019 · 1 comment

Comments

@aalokt89
Copy link

I'm trying to figure out how to change the strokeColor of a LineChart. Ideally, I don't want to use external css (I'm trying to use this in FramerX). This is what I have so far:

        <Frame height={height} width={width} position="relative">
            <div style={chartContainerStyle}>
                <d3.LineChart
                    
                    data={data}
                    width={width}
                    height={height}
                    margin={{ top: 16, bottom: 32, left: 32, right: 16 }}
                    xAxis={{
                        tickPadding: 8,
                        innerTickSize: 0,
                        label: props.xLabel,
                    }}
                    yAxis={{
                        tickPadding: 8,
                        innerTickSize: 0,
                        label: props.yLabel,
                    }}
                    stroke={{
                        strokeWidth,
                        strokeColor: strokeColor,
                        strokeLinecap: "round",
                    }}
                   
                />
            </div>
        </Frame>
    )
}

LineChart.defaultProps = {
    height: 400,
    width: 400,
    strokeWidth: 2,
    strokeColor: "#000",
}```
@codesuki
Copy link
Owner

You should set the colorscale similarly to the example in the readme.

var colorScale = d3.scale.category20();

<BarChart xScale={xScale}
      yScale={yScale}
      colorScale={colorScale}
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants