Chartjs-Protractor – Get array from canvas attribute in Angular2 using ng2-charts/Chart.js

0👍

Did you try it like this…

var canvas = element(by.css("canvas#test[datasets]"));
canvas.evaluate("chartData").then(function (datasets) {
    // datasets is an array of objects that each have data, label, etc.
    console.dir(datasets[0].data);
});

Note, I just derived this from the SO answer in your question + my knowledge of ng2-charts (I have not used Protractor before).

Leave a comment