创建此图的代码是
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
label: 'Submission',
data: [{
t: new Date("April 1, 2018"),
y: 2
}, {
t: new Date("April 10, 2018"),
y: 1
}, {
t: new Date("April 27, 2018"),
y: 1
}],
backgroundColor: ["rgba(90, 150, 200, 0.6)"]
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
Run Code Online (Sandbox Code Playgroud)
显然有三个数据点,但它似乎只显示图表上的 2。如何解决这个问题?
假设我有以下代码:
class Board
{
protected:
std::vector<Piece*> pieces;
}
class ChessBoard : public Board
{
protected:
std::vector<ChessPiece*> pieces;
}
Run Code Online (Sandbox Code Playgroud)
我希望派生类pieces用这个 new覆盖受保护的变量vector,但是我遇到了困难,而且这似乎是不好的做法。