mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-12 15:08:45 +08:00
added toggle account chart lines
This commit is contained in:
parent
f13aba003c
commit
80be9103b8
3 changed files with 43 additions and 1 deletions
|
@ -2905,6 +2905,10 @@
|
|||
<i class="fas fa-bullseye"></i>
|
||||
Toggle Accuracy
|
||||
</div>
|
||||
<div class="toggleChartStyle button">
|
||||
<i class="fas fa-chart-line"></i>
|
||||
Toggle Chart Style
|
||||
</div>
|
||||
</div>
|
||||
<div class="group dailyActivityChart">
|
||||
<div class="chart" style="height: 200px;">
|
||||
|
|
|
@ -2507,6 +2507,10 @@ $(".pageAccount .toggleAccuracyOnChart").click((params) => {
|
|||
toggleChartAccuracy();
|
||||
});
|
||||
|
||||
$(".pageAccount .toggleChartStyle").click((params) => {
|
||||
toggleChartStyle();
|
||||
});
|
||||
|
||||
$(document).on("click", ".pageAccount .group.history #resultEditTags", (f) => {
|
||||
if (dbSnapshot.tags.length > 0) {
|
||||
let resultid = $(f.target).parents("span").attr("resultid");
|
||||
|
|
|
@ -62,7 +62,8 @@ let defaultConfig = {
|
|||
paceCaret: "off",
|
||||
paceCaretCustomSpeed: 100,
|
||||
pageWidth: "100",
|
||||
chartAccuracy: true
|
||||
chartAccuracy: true,
|
||||
chartStyle: "line"
|
||||
};
|
||||
|
||||
let cookieConfig = null;
|
||||
|
@ -205,6 +206,7 @@ function applyConfig(configObj) {
|
|||
setPaceCaretCustomSpeed(configObj.paceCaretCustomSpeed, true);
|
||||
setPageWidth(configObj.pageWidth, true);
|
||||
setChartAccuracy(configObj.chartAccuracy, true);
|
||||
setChartStyle(configObj.chartStyle, true);
|
||||
|
||||
config.startGraphsAtZero = configObj.startGraphsAtZero;
|
||||
// if (
|
||||
|
@ -316,6 +318,19 @@ function updateChartAccuracy() {
|
|||
resultHistoryChart.update();
|
||||
}
|
||||
|
||||
function updateChartStyle() {
|
||||
if (config.chartStyle == "scatter") {
|
||||
resultHistoryChart.data.datasets[0].showLine = false;
|
||||
resultHistoryChart.data.datasets[1].showLine = false;
|
||||
|
||||
} else {
|
||||
resultHistoryChart.data.datasets[0].showLine = true;
|
||||
resultHistoryChart.data.datasets[1].showLine = true;
|
||||
|
||||
}
|
||||
resultHistoryChart.update();
|
||||
}
|
||||
|
||||
function toggleChartAccuracy() {
|
||||
if (config.chartAccuracy) {
|
||||
config.chartAccuracy = false;
|
||||
|
@ -335,6 +350,25 @@ function setChartAccuracy(chartAccuracy, nosave) {
|
|||
if (!nosave) saveConfigToCookie();
|
||||
}
|
||||
|
||||
function toggleChartStyle() {
|
||||
if (config.chartStyle == "scatter") {
|
||||
config.chartStyle = "line";
|
||||
} else {
|
||||
config.chartStyle = "scatter";
|
||||
}
|
||||
updateChartStyle();
|
||||
saveConfigToCookie();
|
||||
}
|
||||
|
||||
function setChartStyle(chartStyle, nosave) {
|
||||
if (chartStyle == undefined) {
|
||||
chartStyle = "line";
|
||||
}
|
||||
config.chartStyle = chartStyle;
|
||||
updateChartStyle();
|
||||
if (!nosave) saveConfigToCookie();
|
||||
}
|
||||
|
||||
//read ahead mode
|
||||
// function toggleReadAheadMode() {
|
||||
// config.readAheadMode = !config.readAheadMode;
|
||||
|
|
Loading…
Reference in a new issue