chartjs / chartjs-chart-financial

Chart.js module for charting financial securities
MIT License
743 stars 199 forks source link

candlestick chart error #30

Closed rashearth closed 6 years ago

rashearth commented 6 years ago

Hi i have two error for working on the candlestick chart. I have entered the time scale label and the data ({o:1, h:3, l: 1, c:2}, ) in the sample in the file to make a simple candlestick chart, but it appears to not work. no graph appears.(Please refer source 1)

Also, I have made a candlestick chart with line chart combined(please refer source2) but, does not work. instead, the bar+candlestick chart would appear not bad, but when pointing the mouse, the o,h,l,c value just shows NaH.

Sorry for bothering, but someone kindly tell me what I am wrong for issue? Thank you in advance

// source 1 var ctx = document.getElementById("chart1").getContext("2d"); ctx.canvas.width = 1000; ctx.canvas.height = 250; var chart1=new Chart(ctx, { type: 'candlestick',

        data: {

            datasets: [{
                label: "CHRT - Chart.js Corporation",
                data: [
            {o:1, h:3, l: 1, c:2}, 
                        {o:4, h:5, l: 1, c:1}

]

                fractionalDigitsCount: 2,
            }],

labels: ['January', 'February']

        },
        options: {
            tooltips: {
                position: 'nearest',
                mode: 'index',
            },
        },
    });

//source2

rashearth commented 6 years ago

OKAY, I GOT IT. II needed to write like below!

{ t: 'April 01 2018', o: 70.87, h: 80.13, l: 40.94, c: 50.24 },