ankane / react-chartkick

Create beautiful JavaScript charts with one line of React
https://chartkick.com/react
MIT License
1.2k stars 58 forks source link

Line Chart with Dual Axis? #51

Closed wootwoot1234 closed 3 years ago

wootwoot1234 commented 3 years ago

Hello. I'm hoping to use the dual-axis feature of chart.js. This is what I've tried but it's not working, I can't figure out how to assign a yAxisID to each dataset. How to I use the dual-axis feature with chartkick?

<LineChart
    data={[
        {
            name: "A",
            yAxisID: "A",
            data: [100, 96, 84, 76, 69]
        },
        {
            name: "B",
            yAxisID: "B",
            data: [1, 1, 1, 1, 0]
        }
    ]}
    library={{
        scales: {
            yAxes: [
                {
                    id: "A",
                    type: "linear",
                    position: "left"
                },
                {
                    id: "B",
                    type: "linear",
                    position: "right",
                    ticks: {
                        max: 1,
                        min: 0
                    }
                }
            ]
        }
    }}
/>

For reference, this is the example I'm trying to copy.

ankane commented 3 years ago

Hey @wootwoot1234, unfortunately, I don't have the bandwidth to help with customizing charts. Check out the Contributing Guide for where to get help.