cleaned chart code/added cells chart

This commit is contained in:
Max Robinson
2021-02-11 13:24:42 -07:00
parent 7b19798be9
commit 9626cd54d6
12 changed files with 137 additions and 51 deletions

View File

@@ -0,0 +1,51 @@
const CellStates = require("../../Organism/Cell/CellStates");
const FossilRecord = require("../FossilRecord");
const ChartController = require("./ChartController");
class CellsChart extends ChartController {
constructor() {
super("Organism Size / Composition");
}
setData() {
this.clear();
//this.mouth, this.producer, this.mover, this.killer, this.armor, this.eye
this.data.push({
type: "line",
markerType: "none",
color: 'black',
showInLegend: true,
name: "pop1",
legendText: "Avg. organism size",
dataPoints: []
}
);
for (var c of CellStates.living) {
this.data.push({
type: "line",
markerType: "none",
color: c.color,
showInLegend: true,
name: c.name,
legendText: "Avg. " + c.name + " cells",
dataPoints: []
}
);
}
this.addAllDataPoints();
}
addDataPoint(i) {
var t = FossilRecord.tick_record[i];
var p = FossilRecord.av_cells[i];
this.data[0].dataPoints.push({x:t, y:p});
var j=1;
for (var name in FossilRecord.av_cell_counts[i]) {
var count = FossilRecord.av_cell_counts[i][name];
this.data[j].dataPoints.push({x:t,y:count})
j++;
}
}
}
module.exports = CellsChart;