chartjs / chartjs-chart-financial

Chart.js module for charting financial securities
MIT License
725 stars 197 forks source link

When using candlestick type, and adding "scatter" type, the dots are connected with line #46

Closed tomthedude closed 5 years ago

tomthedude commented 5 years ago

hello, i am using candlestick, and when i am adding scattered dots, the are being connected with line. and when i remove the candlestick type and use only scatter, it works ok (all on the same graph of course), i have attached photo of both: candles + scatter: cansca

scatter only: scatonly

here is the chart conf:

new Chart(ctx, {
   type: 'candlestick',
    data: {
        datasets: [{
            label: 'BTC-ADA',
            data: candles
        },{
        label: 'Buys',
                    data: buys,
                    borderColor: "green",
                    fill: false,
                     type: 'scatter',
        },{
        label: 'Sells',
                    data: sells,
                    fill: false,
                    borderColor: "red",
                     type: 'scatter',
        }]
    },
    options: {

        tooltips: {
                    position: 'nearest',
                    mode: 'index',
                },                      pan: {
                        enabled: true,
                        mode: 'xy',
                        speed: 10,
                        threshold: 10
                    },
                        zoom: {
                        enabled: true,
                        mode: 'xy',
                        limits: {
                            max: 10,
                            min: 0.5
                        }
                    },

    }
        });

please advise how to fix this bug.

benmccann commented 5 years ago

Yes, unfortunately Chart.js has lots of issues with mixed chart types because the options from the various charts collide with each other. I'd like for this to improve. You can see more details here: https://github.com/chartjs/Chart.js/pull/5151

Ultimately I think this is a bug in the upstream library and there's already a handful of bugs filed there to track it, so I'm going to close this for now. If you'd like to contribute towards fixing the bug we really need some help with https://github.com/chartjs/Chart.js/issues/5191