chartjs / chartjs-chart-financial

Chart.js module for charting financial securities
MIT License
721 stars 196 forks source link

mixed types #96

Closed erikjonkers closed 3 years ago

erikjonkers commented 3 years ago

Hi,

I try to use mixed types: https://www.chartjs.org/docs/latest/charts/mixed.html

But the 'type' value is dominant at a higher level;

var chart = new Chart(ctx, {
        type: "candlestick",
        data: {
            datasets: [{
                type: "candlestick",
                label: marketName,
                data: candleData
            }, {
                type: "line",
                label: supportLevel,
                data: lineData
            }
        }
    }
);
CupcakeThief commented 3 years ago

Looks fine to me, but could do with some coverage for this in the demo page. (working with chartjs 3.2.1)

image

Daanra commented 3 years ago

@CupcakeThief

Would you mind sharing your code? I'm also unable to get mixed types working.

CupcakeThief commented 3 years ago

Can't do that, as it's all in C#/Blazor, would be more confusing than helpful.

Instead I've twiddled the sample page, see pull request #97 which adds a line for close prices.

CupcakeThief commented 3 years ago

I've fixed tooltip labeling for mixed charts, under the same PR.

CupcakeThief commented 3 years ago

NB there's quite a big gotcha with financial plugin; parsing for datetime values is disabled by default, for performance. Make sure you convert x values to epoch timestamps, e.g. as per demo page

x: luxon.DateTime.fromRFC2822(dateStr)
benmccann commented 3 years ago

fixed by https://github.com/chartjs/chartjs-chart-financial/pull/97