Skip to content

Commit

Permalink
improve chart design (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
ProjectsByJackHe authored Aug 5, 2024
1 parent 291da15 commit 37271c3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ function generateQuicV2Dataset() {
return output
}

function createDataset(name, data) {
function createDataset(name, data, fillColor) {
return {
type: "line",
label: name,
borderWidth: dataLineWidth,
pointRadius: dataRawPointRadius,
tension: 0,
data: data.slice(-dataMaxCount)
data: data.slice(-dataMaxCount),
backgroundColor: fillColor || "rgba(0, 0, 255, 0.5)",
};
}

Expand Down Expand Up @@ -122,9 +123,9 @@ function createChart() {
createChartwithData("canvasReachable", reachable, false, false)

var breakdown = []
breakdown.push(createDataset("Reachable", generateGoodReachableDataset()))
breakdown.push(createDataset("Reachable (Too Much)", generateTooMuchDataset()))
breakdown.push(createDataset("Reachable (Multi RTT)", generateMultiRttDataset()))
breakdown.push(createDataset("Reachable", generateGoodReachableDataset(), "rgba(0, 255, 0, 0.5)"))
breakdown.push(createDataset("Reachable (Too Much)", generateTooMuchDataset(), "rgba(255, 0, 0, 0.5)"))
breakdown.push(createDataset("Reachable (Multi RTT)", generateMultiRttDataset(), "rgba(0, 0, 255, 0.5)"))
createChartwithData("canvasReachBreakdown", breakdown, true, true)

var quicv2 = []
Expand Down

0 comments on commit 37271c3

Please sign in to comment.