|
|
@@ -235,14 +235,22 @@ function generateCharts(resultProperties: ResultProperties): void { |
|
|
|
* Outcomes |
|
|
|
*/ |
|
|
|
|
|
|
|
// sort so we have failure before success |
|
|
|
let oc = resultProperties.rollstats.outcomeCounts; |
|
|
|
let okeys = Object.keys(oc).sort(); |
|
|
|
let ovalues = []; |
|
|
|
for (let i = 0; i < okeys.length; i++) { |
|
|
|
ovalues.push(oc[okeys[i] as Outcomes]); |
|
|
|
} |
|
|
|
|
|
|
|
let outcomesCanvas: any = $(`#${outcomesChartId}`); |
|
|
|
let outcomesChart = new Chart(outcomesCanvas, { |
|
|
|
type: "bar", |
|
|
|
data: { |
|
|
|
labels: Object.keys(resultProperties.rollstats.outcomeCounts), |
|
|
|
labels: okeys, |
|
|
|
datasets: [{ |
|
|
|
label: "Outcome Counts", |
|
|
|
data: Object.values(resultProperties.rollstats.outcomeCounts), |
|
|
|
data: ovalues, |
|
|
|
backgroundColor: hexColours(Object.values(resultProperties.rollstats.outcomeCounts).length), |
|
|
|
}], |
|
|
|
}, |
|
|
@@ -259,7 +267,7 @@ function generateCharts(resultProperties: ResultProperties): void { |
|
|
|
// sort values too |
|
|
|
let values = []; |
|
|
|
for (let i = 0; i < keys.length; i++) { |
|
|
|
values.push(resultProperties.rollstats.balanceCounts[keys[i]]); |
|
|
|
values.push(bc[keys[i]]); |
|
|
|
} |
|
|
|
|
|
|
|
let balanceCanvas: any = $(`#${balanceChartId}`); |
|
|
@@ -291,7 +299,7 @@ function generateTables(resultProperties: ResultProperties): void { |
|
|
|
let outcomesTableId = `outcomesTable-${itemId}`; |
|
|
|
|
|
|
|
let oc = resultProperties.rollstats.outcomeCounts; |
|
|
|
let okeys = Object.keys(oc); |
|
|
|
let okeys = Object.keys(oc).sort(); |
|
|
|
for (var i = 0; i < okeys.length; i++) { |
|
|
|
let tb = $(`#${outcomesTableId}`).find("tbody"); |
|
|
|
let outcome: Outcomes = okeys[i] as Outcomes; |
|
|
|