最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - charts.js straight lines - i cant find a solution - Stack Overflow

programmeradmin4浏览0评论

So im using charts.js / and im trying to make the lines between 2 dots be straight and not curvy for no apperent reason.

it right now looks like that .png

and i want it to look like basic algebric graphs should look like the other picture in the above link

current datasets:

                label: "Shop Sales",
                fillColor : "rgba(255, 89, 114, 0.6)",
                strokeColor : "rgba(51, 51, 51, 1)",
                pointColor : "rgba(255, 89, 114, 1)",
                pointStrokeColor : "#fff",
                pointHighlightFill : "#fff",
                pointHighlightStroke : "rgba(151,187,205,1)",
                maintainAspectRatio: false,

and

window.onload = function(){
    var ctx = document.getElementById("canvas").getContext("2d");

    window.myLine = new Chart(ctx).Line(lineChartData, {
responsive: true, scaleFontColor: "#FF5972" }

)};

thank you, im searching for this on the web everywhere

So im using charts.js http://www.chartjs/ and im trying to make the lines between 2 dots be straight and not curvy for no apperent reason.

it right now looks like that https://i.sstatic/rK8df.png

and i want it to look like basic algebric graphs should look like the other picture in the above link

current datasets:

                label: "Shop Sales",
                fillColor : "rgba(255, 89, 114, 0.6)",
                strokeColor : "rgba(51, 51, 51, 1)",
                pointColor : "rgba(255, 89, 114, 1)",
                pointStrokeColor : "#fff",
                pointHighlightFill : "#fff",
                pointHighlightStroke : "rgba(151,187,205,1)",
                maintainAspectRatio: false,

and

window.onload = function(){
    var ctx = document.getElementById("canvas").getContext("2d");

    window.myLine = new Chart(ctx).Line(lineChartData, {
responsive: true, scaleFontColor: "#FF5972" }

)};

thank you, im searching for this on the web everywhere

Share Improve this question asked Feb 17, 2015 at 18:12 downrep_nationdownrep_nation 4521 gold badge7 silver badges16 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 10

Set the option bezierCurve to false.

window.onload = function(){
    var ctx = document.getElementById("canvas").getContext("2d");

    window.myLine = new Chart(ctx).Line(lineChartData, {
      responsive: true, 
      scaleFontColor: "#FF5972",
      bezierCurve: false
    });

});

It's right there in the Line Chart option list.. You can also have them be curved but "stiffer" by leaving the option set and then varying the bezierCurveTension property.

It looks like it's been changed with v2.0. It is now tension:0. As of this writing the docs state it's lineTension:0, but that seems incorrect.

发布评论

评论列表(0)

  1. 暂无评论