FVANCOP / ChartNew.js

MIT License
420 stars 143 forks source link

Incorrect drawn vertical lines #481

Closed luna2761 closed 7 years ago

luna2761 commented 7 years ago

Hello!

I've downloaded the latest version of ChartNew.js and have a problem, very close to the one, appeared in Issue#310 - line is not vertical&incorrect. I need to create 2 vertical lines for first two labels, for example. So

var mydata = {
            labels: ['first', 'second', 'third', 'fourth'],
            datasets: [
                {
                    //type: "Bar",
                    fillColor: "rgba(220,220,220,0.5)",
                    strokeColor: "rgba(220,220,220,1)",
                    pointColor: "rgba(220,220,220,1)",
                    pointStrokeColor: "#fff",
                    data: [3, 2, 3, 0],
                    title: "Team #1",
                    axis: 1
                },
             {
                    type: "Line",
                    pointColor: "rgba(0,0,0,1)",
                    strokeColor: "blue",
                    pointStrokeColor: "rgba(0,0,0,0)",
                    data: [0, 1, 2, 3],
                    xPos: [3, 3, 3, 3],
                    title: "Vertical Line 3"
                },
                {
                    type: "Line",
                    pointColor: "rgba(0,0,0,1)",
                    strokeColor: "grey",
                    pointStrokeColor: "rgba(0,0,0,0)",
                    data: [0, 1, 2],
                    xPos: [0, 0, 0, 0],
                    title: "Vertical Line 4"
                }
            ]
        };

To create chart:

var myLine = new Chart(document.getElementById("mycanvas").getContext("2d")).Bar(mydata,newopts);

However, my lines are not vertical.

incorrect

What is interesting, if I change labels to numbers, lines are created correctly.

var mydata = {
            labels: [0, 1, 2, 3],
...

correct

Thank you.

FVANCOP commented 7 years ago

Hi,

Problem has been fixed in last published version. Can you try it ?

Thanks for reporting the bug.

Regards, François

luna2761 commented 7 years ago

Hi,

Works fine now.

Thank you.