mirror of
https://github.com/SqrtMinusOne/sqrtminusone.github.io.git
synced 2025-12-10 15:53:03 +03:00
feat(emacs): more charts
This commit is contained in:
parent
b8a68761dd
commit
9518c83a0d
5 changed files with 329 additions and 4 deletions
|
|
@ -9,6 +9,18 @@ scripts = ["/js/chart.js", "/js/chartjs-adapter-date-fns.bundle.min.js", "/js/ch
|
|||
|
||||
Hello world
|
||||
|
||||
|
||||
## Numbers {#numbers}
|
||||
|
||||
- Total time on Config: <span data-num="config_hours_total">[REDACTED]</span>
|
||||
- Total time on Packages: <span data-num="package_hours_total">[REDACTED]</span>
|
||||
- % time on Config: <span data-num="config_hours_percent">[REDACTED]</span>
|
||||
- Hours on `org-journal-tags`: <span data-num="org-journal-tags_total">[REDACTED]</span>
|
||||
- Total time on Vim config: 39 hours
|
||||
|
||||
|
||||
## Charts {#charts}
|
||||
|
||||
<canvas id="chart-emacs-history"></canvas>
|
||||
|
||||
<canvas id="chart-emacs-time"></canvas>
|
||||
|
|
@ -18,3 +30,7 @@ Hello world
|
|||
<canvas id="chart-emacs-config-size"></canvas>
|
||||
|
||||
<canvas id="chart-emacs-vim-config-size"></canvas>
|
||||
|
||||
<canvas id="chart-emacs-packages"></canvas>
|
||||
|
||||
<canvas id="chart-emacs-vim-switch"></canvas>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,15 @@
|
|||
|
||||
Hello world
|
||||
|
||||
* Numbers
|
||||
- Total time on Config: @@html:<span data-num="config_hours_total">[REDACTED]</span>@@
|
||||
- Total time on Packages: @@html:<span data-num="package_hours_total">[REDACTED]</span>@@
|
||||
- % time on Config: @@html:<span data-num="config_hours_percent">[REDACTED]</span>@@
|
||||
- Hours on =org-journal-tags=: @@html:<span data-num="org-journal-tags_total">[REDACTED]</span>@@
|
||||
- Total time on Vim config: 39 hours
|
||||
|
||||
* Charts
|
||||
|
||||
#+begin_export html
|
||||
<canvas id="chart-emacs-history"></canvas>
|
||||
#+end_export
|
||||
|
|
@ -27,3 +36,11 @@ Hello world
|
|||
#+begin_export html
|
||||
<canvas id="chart-emacs-vim-config-size"></canvas>
|
||||
#+end_export
|
||||
|
||||
#+begin_export html
|
||||
<canvas id="chart-emacs-packages"></canvas>
|
||||
#+end_export
|
||||
|
||||
#+begin_export html
|
||||
<canvas id="chart-emacs-vim-switch"></canvas>
|
||||
#+end_export
|
||||
|
|
|
|||
78
static/data/2023-03-14-emacs/emacs-packages.json
Normal file
78
static/data/2023-03-14-emacs/emacs-packages.json
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
[
|
||||
{"name":"org-journal-tags","hours":45.80413027777777},
|
||||
{"name":"Unknown Project","hours":30.883538055555544},
|
||||
{"name":"elfeed-summary","hours":24.781949999999995},
|
||||
{"name":"lyrics-fetcher","hours":19.423725},
|
||||
{"name":"reverso","hours":16.14068888888889},
|
||||
{"name":"pomm","hours":15.724073888888888},
|
||||
{"name":"elfeed_sync","hours":10.33835},
|
||||
{"name":"perspective-exwm","hours":7.68676111111111},
|
||||
{"name":"ivy-pass","hours":4.8407888888888895},
|
||||
{"name":"exwm-modeline","hours":4.785227777777777},
|
||||
{"name":"elfeed","hours":1.9590416666666668},
|
||||
{"name":"elfeed-recommender","hours":1.606401111111111},
|
||||
{"name":"avy-dired","hours":1.5198916666666664},
|
||||
{"name":"sqrtminusone.xyz","hours":1.4861027777777778},
|
||||
{"name":"copilot","hours":1.393622222222222},
|
||||
{"name":"SEM10_DataP","hours":1.3383138888888888},
|
||||
{"name":"org-mode","hours":1.285122222222222},
|
||||
{"name":"emms","hours":1.2402194444444448},
|
||||
{"name":"digital-trajectories-backend","hours":0.817338888888889},
|
||||
{"name":"SEM11_SD","hours":0.6001722222222221},
|
||||
{"name":"dank-mode","hours":0.5951249999999999},
|
||||
{"name":"org-roam","hours":0.5180888888888888},
|
||||
{"name":"sqrtminusone.github.io","hours":0.4424444444444445},
|
||||
{"name":"eshell-info-banner","hours":0.3441305555555555},
|
||||
{"name":"org-ref","hours":0.3417222222222222},
|
||||
{"name":"org","hours":0.33160555555555554},
|
||||
{"name":"org-contrib","hours":0.2974138888888889},
|
||||
{"name":"perspective-el","hours":0.291275},
|
||||
{"name":"wakatime-mode","hours":0.2859333333333333},
|
||||
{"name":"exwm","hours":0.2593944444444445},
|
||||
{"name":"elcord","hours":0.25727777777777777},
|
||||
{"name":"general","hours":0.2553944444444444},
|
||||
{"name":"digital-trajectories-frontend","hours":0.25507222222222226},
|
||||
{"name":"flycheck-mix-alphabets","hours":0.1779611111111111},
|
||||
{"name":"evil-collection","hours":0.17116388888888892},
|
||||
{"name":"lispy","hours":0.16847222222222222},
|
||||
{"name":"devdocs","hours":0.16563333333333333},
|
||||
{"name":"mmm-mode","hours":0.14494444444444443},
|
||||
{"name":"posframe","hours":0.13803333333333334},
|
||||
{"name":"ytel","hours":0.13270833333333334},
|
||||
{"name":"melpa","hours":0.11238055555555555},
|
||||
{"name":"tldr","hours":0.11088888888888888},
|
||||
{"name":"org-journal","hours":0.10692777777777777},
|
||||
{"name":"deft","hours":0.09949999999999999},
|
||||
{"name":"org-transclusion","hours":0.08256666666666668},
|
||||
{"name":"transient","hours":0.08187777777777777},
|
||||
{"name":"treemacs","hours":0.08161666666666667},
|
||||
{"name":"lsp-treemacs","hours":0.07749722222222223},
|
||||
{"name":"web-mode","hours":0.07611666666666667},
|
||||
{"name":"dap-mode","hours":0.070775},
|
||||
{"name":"themes","hours":0.06796666666666668},
|
||||
{"name":"Emacs-langtool","hours":0.06696388888888888},
|
||||
{"name":"projectile","hours":0.0635},
|
||||
{"name":"doom-modeline","hours":0.06344999999999999},
|
||||
{"name":"package-build","hours":0.06199444444444445},
|
||||
{"name":"emacs-which-key","hours":0.06048055555555555},
|
||||
{"name":"jest-test-mode","hours":0.05506944444444444},
|
||||
{"name":"gazprom-classes-frontend","hours":0.04866388888888889},
|
||||
{"name":"digital-schedule-backend","hours":0.04549166666666667},
|
||||
{"name":"company-mode","hours":0.04083888888888889},
|
||||
{"name":"emacs-jupyter","hours":0.03719166666666666},
|
||||
{"name":"swiper","hours":0.03139444444444444},
|
||||
{"name":"org-habit-stats","hours":0.028275},
|
||||
{"name":"SEM9_AMOS","hours":0.016411111111111112},
|
||||
{"name":"elfeed-org","hours":0.014444444444444446},
|
||||
{"name":"org-agenda-conflict","hours":0.013563888888888887},
|
||||
{"name":"org-ql","hours":0.013541666666666667},
|
||||
{"name":"test","hours":0.013236111111111112},
|
||||
{"name":"alert","hours":0.012311111111111111},
|
||||
{"name":"prodigy","hours":0.0079},
|
||||
{"name":"lsp-mode","hours":0.007405555555555556},
|
||||
{"name":"google-translate","hours":0.007016666666666668},
|
||||
{"name":"err","hours":0.005344444444444444},
|
||||
{"name":"testing","hours":0.004497222222222223},
|
||||
{"name":"dired-plus","hours":0.003427777777777778},
|
||||
{"name":"magit","hours":0.0}
|
||||
]
|
||||
42
static/data/2023-03-14-emacs/emacs-vim-switch.json
Normal file
42
static/data/2023-03-14-emacs/emacs-vim-switch.json
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
[
|
||||
{"period":"2020-10-01T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":0.0,"vim_other_code_hours":4.593828333333334,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-02T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":0.0,"vim_other_code_hours":5.804007777777778,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-03T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":0.0,"vim_other_code_hours":0.7722222222222223,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-04T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":0.0,"vim_other_code_hours":4.997453333333334,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-05T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":0.0,"vim_other_code_hours":3.792777777777778,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-06T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":0.0,"vim_other_code_hours":1.2219444444444443,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-07T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":0.0,"vim_other_code_hours":0.6566666666666666,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-08T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":0.0,"vim_other_code_hours":2.1977777777777776,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-09T00:00:00Z","misc_emacs_hours":1.544538888888889,"emacs_other_code_hours":0.0,"vim_other_code_hours":2.2808333333333333,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-10T00:00:00Z","misc_emacs_hours":2.166045,"emacs_other_code_hours":0.0,"vim_other_code_hours":2.765833333333333,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-11T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":0.0,"vim_other_code_hours":1.522777777777778,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-12T00:00:00Z","misc_emacs_hours":3.373538055555555,"emacs_other_code_hours":0.0,"vim_other_code_hours":2.8524999999999996,"config_hours":1.1968416666666668,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-13T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":0.0,"vim_other_code_hours":3.1955855555555557,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-14T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":0.6688305555555559,"vim_other_code_hours":0.07459444444444445,"config_hours":2.822041666666667,"orgmode_hours":0.0,"package_hours":0.06048055555555555},
|
||||
{"period":"2020-10-15T00:00:00Z","misc_emacs_hours":1.0370783333333335,"emacs_other_code_hours":4.3661255555555565,"vim_other_code_hours":0.24187555555555554,"config_hours":3.7891083333333335,"orgmode_hours":0.0,"package_hours":0.2898111111111111},
|
||||
{"period":"2020-10-16T00:00:00Z","misc_emacs_hours":1.2085813888888888,"emacs_other_code_hours":2.804672222222222,"vim_other_code_hours":0.0020166666666666666,"config_hours":0.4711361111111111,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-10-17T00:00:00Z","misc_emacs_hours":1.5149327777777772,"emacs_other_code_hours":1.431163888888889,"vim_other_code_hours":0.24356111111111112,"config_hours":2.4144055555555557,"orgmode_hours":1.0415694444444443,"package_hours":0.0},
|
||||
{"period":"2020-10-18T00:00:00Z","misc_emacs_hours":1.185498611111111,"emacs_other_code_hours":4.190124999999999,"vim_other_code_hours":0.0,"config_hours":0.1758361111111111,"orgmode_hours":0.5317666666666666,"package_hours":0.0},
|
||||
{"period":"2020-10-19T00:00:00Z","misc_emacs_hours":1.0136511111111104,"emacs_other_code_hours":2.7192686111111115,"vim_other_code_hours":0.0022222222222222222,"config_hours":0.03091111111111111,"orgmode_hours":0.3985694444444444,"package_hours":0.0},
|
||||
{"period":"2020-10-20T00:00:00Z","misc_emacs_hours":1.6019416666666655,"emacs_other_code_hours":1.8278999999999996,"vim_other_code_hours":0.0,"config_hours":0.09761388888888889,"orgmode_hours":1.1227472222222223,"package_hours":0.0},
|
||||
{"period":"2020-10-21T00:00:00Z","misc_emacs_hours":0.10150999999999932,"emacs_other_code_hours":4.24669138888889,"vim_other_code_hours":0.014744444444444444,"config_hours":0.4583833333333333,"orgmode_hours":0.1297222222222222,"package_hours":0.0},
|
||||
{"period":"2020-10-22T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":5.37636388888889,"vim_other_code_hours":0.05089722222222222,"config_hours":0.024694444444444446,"orgmode_hours":0.21722777777777777,"package_hours":0.0},
|
||||
{"period":"2020-10-23T00:00:00Z","misc_emacs_hours":0.40990444444444485,"emacs_other_code_hours":4.576274999999999,"vim_other_code_hours":0.09225833333333333,"config_hours":0.6420833333333333,"orgmode_hours":0.5016444444444444,"package_hours":0.08161666666666667},
|
||||
{"period":"2020-10-24T00:00:00Z","misc_emacs_hours":0.07689472222222271,"emacs_other_code_hours":1.2494466666666666,"vim_other_code_hours":0.0061111111111111106,"config_hours":0.4475111111111111,"orgmode_hours":0.8585111111111111,"package_hours":0.0},
|
||||
{"period":"2020-10-25T00:00:00Z","misc_emacs_hours":1.3529136111111115,"emacs_other_code_hours":2.2984227777777777,"vim_other_code_hours":0.0,"config_hours":0.22775833333333334,"orgmode_hours":0.03581666666666667,"package_hours":0.0},
|
||||
{"period":"2020-10-26T00:00:00Z","misc_emacs_hours":2.2822991666666663,"emacs_other_code_hours":1.8299355555555556,"vim_other_code_hours":0.21062777777777777,"config_hours":0.5299861111111112,"orgmode_hours":0.9724463888888889,"package_hours":0.0},
|
||||
{"period":"2020-10-27T00:00:00Z","misc_emacs_hours":2.4492977777777787,"emacs_other_code_hours":1.3149833333333336,"vim_other_code_hours":0.0,"config_hours":1.6067777777777779,"orgmode_hours":0.7547583333333333,"package_hours":0.0},
|
||||
{"period":"2020-10-28T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":0.9042833333333333,"vim_other_code_hours":0.08348333333333334,"config_hours":0.7079055555555556,"orgmode_hours":0.14482499999999998,"package_hours":0.0},
|
||||
{"period":"2020-10-29T00:00:00Z","misc_emacs_hours":0.328835555555556,"emacs_other_code_hours":3.784140277777778,"vim_other_code_hours":0.15638888888888888,"config_hours":0.4212972222222222,"orgmode_hours":0.07462222222222221,"package_hours":0.0},
|
||||
{"period":"2020-10-30T00:00:00Z","misc_emacs_hours":0.27459194444444435,"emacs_other_code_hours":0.07239999999999996,"vim_other_code_hours":0.2136111111111111,"config_hours":0.38052222222222226,"orgmode_hours":0.20900277777777776,"package_hours":0.0},
|
||||
{"period":"2020-10-31T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":2.46487,"vim_other_code_hours":0.0,"config_hours":0.16100555555555557,"orgmode_hours":0.04638055555555556,"package_hours":0.0},
|
||||
{"period":"2020-11-01T00:00:00Z","misc_emacs_hours":0.609663055555556,"emacs_other_code_hours":5.329877777777778,"vim_other_code_hours":0.0,"config_hours":0.02627777777777778,"orgmode_hours":0.30374999999999996,"package_hours":0.0},
|
||||
{"period":"2020-11-02T00:00:00Z","misc_emacs_hours":1.6059166666666673,"emacs_other_code_hours":2.984023055555556,"vim_other_code_hours":0.02325,"config_hours":0.8176666666666665,"orgmode_hours":0.016177777777777777,"package_hours":0.003427777777777778},
|
||||
{"period":"2020-11-03T00:00:00Z","misc_emacs_hours":0.3323786111111109,"emacs_other_code_hours":2.076485,"vim_other_code_hours":0.0,"config_hours":0.0,"orgmode_hours":0.44376611111111114,"package_hours":0.0},
|
||||
{"period":"2020-11-04T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":5.921964722222222,"vim_other_code_hours":0.0,"config_hours":0.500686111111111,"orgmode_hours":1.411311111111111,"package_hours":0.0},
|
||||
{"period":"2020-11-05T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":7.012325,"vim_other_code_hours":0.0,"config_hours":0.3160166666666667,"orgmode_hours":0.008994444444444446,"package_hours":0.0},
|
||||
{"period":"2020-11-06T00:00:00Z","misc_emacs_hours":0.8303497222222229,"emacs_other_code_hours":1.9601530555555557,"vim_other_code_hours":0.0,"config_hours":0.0,"orgmode_hours":1.155611111111111,"package_hours":0.0},
|
||||
{"period":"2020-11-07T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":5.815349444444445,"vim_other_code_hours":0.0,"config_hours":0.0,"orgmode_hours":0.0,"package_hours":0.0},
|
||||
{"period":"2020-11-08T00:00:00Z","misc_emacs_hours":0.5992686111111123,"emacs_other_code_hours":7.439156111111109,"vim_other_code_hours":0.0,"config_hours":0.0,"orgmode_hours":0.08499444444444444,"package_hours":0.0},
|
||||
{"period":"2020-11-09T00:00:00Z","misc_emacs_hours":0.0,"emacs_other_code_hours":2.465256666666667,"vim_other_code_hours":0.0,"config_hours":0.0,"orgmode_hours":0.620813888888889,"package_hours":0.0}
|
||||
]
|
||||
|
|
@ -15,7 +15,7 @@ const EMACS_ITEM = {
|
|||
const COLORS = [
|
||||
"#77bceb",
|
||||
"#ff6384",
|
||||
"#77c0c0",
|
||||
"#73d9d9",
|
||||
"#ff9f40",
|
||||
"#ffcd56",
|
||||
"#c9cbcf",
|
||||
|
|
@ -75,6 +75,16 @@ const EMACS_DATA = {
|
|||
yAxisID: "yAxis1",
|
||||
...EMACS_ITEM,
|
||||
},
|
||||
{
|
||||
label: "ranger",
|
||||
data: [
|
||||
{
|
||||
name: "File manager",
|
||||
span: [new Date("2019-04-03"), new Date("2020-02-17")],
|
||||
},
|
||||
],
|
||||
yAxisID: "yAxis2",
|
||||
},
|
||||
{
|
||||
label: "vifm",
|
||||
data: [
|
||||
|
|
@ -169,6 +179,16 @@ const EMACS_DATA = {
|
|||
],
|
||||
yAxisID: "yAxis5",
|
||||
},
|
||||
{
|
||||
label: "Google Play Music",
|
||||
data: [
|
||||
{
|
||||
name: "Multimedia",
|
||||
span: [new Date("2019-05-12"), new Date("2020-07-26")],
|
||||
},
|
||||
],
|
||||
yAxisID: "yAxis6",
|
||||
},
|
||||
{
|
||||
label: "MPD",
|
||||
data: [
|
||||
|
|
@ -250,6 +270,15 @@ const EMACS_DATA = {
|
|||
}),
|
||||
};
|
||||
|
||||
function replaceNumbers(data) {
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
const items = document.querySelectorAll(`[data-num="${key}"]`);
|
||||
for (const item of items) {
|
||||
item.innerHTML = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emacsChart() {
|
||||
const ctx = document.getElementById("chart-emacs-history");
|
||||
new Chart(ctx, {
|
||||
|
|
@ -259,7 +288,7 @@ function emacsChart() {
|
|||
options: {
|
||||
indexAxis: "y",
|
||||
grouped: true,
|
||||
aspectRatio: 1.2,
|
||||
aspectRatio: 1.1,
|
||||
parsing: {
|
||||
yAxisKey: "name",
|
||||
xAxisKey: "span",
|
||||
|
|
@ -345,6 +374,26 @@ async function emacsTimeChart() {
|
|||
backgroundColor: color,
|
||||
})),
|
||||
};
|
||||
const replaceData = {};
|
||||
for (const [key] of labels) {
|
||||
replaceData[`${key}_total`] = 0;
|
||||
replaceData[`${key}_percent`] = 0;
|
||||
}
|
||||
let total = 0;
|
||||
for (const rawDatum of rawData) {
|
||||
for (const [key] of labels) {
|
||||
replaceData[`${key}_total`] += rawDatum[key] || 0;
|
||||
total += rawDatum[key] || 0;
|
||||
}
|
||||
}
|
||||
for (const [key] of labels) {
|
||||
replaceData[`${key}_total`] = replaceData[`${key}_total`].toFixed(1);
|
||||
replaceData[`${key}_percent`] = (
|
||||
(replaceData[`${key}_total`] / total) *
|
||||
100
|
||||
).toFixed(1);
|
||||
}
|
||||
replaceNumbers(replaceData);
|
||||
|
||||
const ctx = document.getElementById("chart-emacs-time");
|
||||
new Chart(ctx, {
|
||||
|
|
@ -609,12 +658,135 @@ async function configsChart() {
|
|||
});
|
||||
}
|
||||
|
||||
async function packagesChart() {
|
||||
const response = await fetch("/data/2023-03-14-emacs/emacs-packages.json");
|
||||
const rawData = await response.json();
|
||||
|
||||
const data = [
|
||||
...rawData.slice(0, 15),
|
||||
{
|
||||
name: "Other",
|
||||
hours: rawData.slice(15).reduce((acc, d) => acc + d.hours, 0),
|
||||
},
|
||||
];
|
||||
|
||||
const replaceData = {};
|
||||
for (const datum of data) {
|
||||
replaceData[`${datum.name}_total`] = datum.hours.toFixed(1);
|
||||
}
|
||||
replaceNumbers(replaceData);
|
||||
|
||||
const ctx = document.getElementById("chart-emacs-packages");
|
||||
new Chart(ctx, {
|
||||
type: "bar",
|
||||
data: {
|
||||
labels: data.map((d) => d.name),
|
||||
datasets: [
|
||||
{
|
||||
data,
|
||||
},
|
||||
],
|
||||
},
|
||||
options: {
|
||||
aspectRatio: 1.3,
|
||||
parsing: {
|
||||
yAxisKey: "name",
|
||||
xAxisKey: "hours",
|
||||
},
|
||||
indexAxis: "y",
|
||||
scales: {
|
||||
x: {
|
||||
title: {
|
||||
display: true,
|
||||
text: "Hours",
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: "Time per Emacs packages",
|
||||
color: "black",
|
||||
font: {
|
||||
size: 15,
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
display: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function emacsVimSwitchChart() {
|
||||
const response = await fetch("/data/2023-03-14-emacs/emacs-vim-switch.json");
|
||||
const rawData = await response.json();
|
||||
const labels = [
|
||||
["config_hours", "Config", "#A989C5"],
|
||||
["package_hours", "Emacs Packages", "#7172AD"],
|
||||
["orgmode_hours", "Org Mode", "#509EE3"],
|
||||
["emacs_other_code_hours", "Other Code (Emacs)", "#F2A86F"],
|
||||
["vim_other_code_hours", "Other Code (Vim)", "#59c26e"],
|
||||
["misc_emacs_hours", "Misc (Emacs)", "#F9D45C"],
|
||||
];
|
||||
const data = {
|
||||
labels: rawData.map((d) => new Date(d["period"])),
|
||||
datasets: labels.map(([key, label, color]) => ({
|
||||
label,
|
||||
data: rawData.map((d) => ({
|
||||
period: new Date(d["period"]),
|
||||
value: d[key],
|
||||
})),
|
||||
backgroundColor: color,
|
||||
})),
|
||||
};
|
||||
|
||||
const ctx = document.getElementById("chart-emacs-vim-switch");
|
||||
new Chart(ctx, {
|
||||
type: "bar",
|
||||
data,
|
||||
options: {
|
||||
parsing: {
|
||||
xAxisKey: "period",
|
||||
yAxisKey: "value",
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
type: "time",
|
||||
min: data.labels[0],
|
||||
stacked: true,
|
||||
},
|
||||
y: {
|
||||
stacked: true,
|
||||
title: {
|
||||
display: true,
|
||||
text: "Hours",
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: "Switch from Emacs to Vim",
|
||||
color: "black",
|
||||
font: {
|
||||
size: 15,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener(
|
||||
"DOMContentLoaded",
|
||||
function () {
|
||||
async function () {
|
||||
emacsChart();
|
||||
emacsTimeChart();
|
||||
configsChart();
|
||||
packagesChart();
|
||||
emacsVimSwitchChart();
|
||||
},
|
||||
false
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue