mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
Make calendar only clickable, if counts > 0
This commit is contained in:
parent
60ed9c1e22
commit
f767a5e6ca
2 changed files with 18 additions and 4 deletions
|
@ -114,7 +114,7 @@ export function renderCalendar(
|
||||||
maxCount = count;
|
maxCount = count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('sourceData', sourceData, dayMap)
|
console.log("sourceData", sourceData, dayMap);
|
||||||
|
|
||||||
if (!maxCount) {
|
if (!maxCount) {
|
||||||
setDataAvailable(svg, false);
|
setDataAvailable(svg, false);
|
||||||
|
@ -207,8 +207,13 @@ export function renderCalendar(
|
||||||
showTooltip(tooltipText(d), x, y);
|
showTooltip(tooltipText(d), x, y);
|
||||||
})
|
})
|
||||||
.on("mouseout", hideTooltip)
|
.on("mouseout", hideTooltip)
|
||||||
|
.attr("class", (d: any): string => {
|
||||||
|
return d.count > 0 ? "clickable" : "";
|
||||||
|
})
|
||||||
.on("click", function (this: any, d: any) {
|
.on("click", function (this: any, d: any) {
|
||||||
dispatch("search", { query: `"prop:rated=${d.day}"` });
|
if (d.count > 0) {
|
||||||
|
dispatch("search", { query: `"prop:rated=${d.day}"` });
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.transition()
|
.transition()
|
||||||
.duration(800)
|
.duration(800)
|
||||||
|
|
|
@ -64,7 +64,7 @@ export function prepareData(
|
||||||
function makeQuery(data: HistogramData, binIdx: number): string {
|
function makeQuery(data: HistogramData, binIdx: number): string {
|
||||||
const bin = data.bins[binIdx];
|
const bin = data.bins[binIdx];
|
||||||
const start = bin.x0!;
|
const start = bin.x0!;
|
||||||
const end = (bin.x1! - 1);
|
const end = bin.x1! - 1;
|
||||||
|
|
||||||
if (start === end) {
|
if (start === end) {
|
||||||
return `"prop:ease=${start / 100}"`;
|
return `"prop:ease=${start / 100}"`;
|
||||||
|
@ -85,7 +85,16 @@ export function prepareData(
|
||||||
];
|
];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{ scale, bins, total, hoverText, makeQuery, colourScale, showArea: false, xTickFormat },
|
{
|
||||||
|
scale,
|
||||||
|
bins,
|
||||||
|
total,
|
||||||
|
hoverText,
|
||||||
|
makeQuery,
|
||||||
|
colourScale,
|
||||||
|
showArea: false,
|
||||||
|
xTickFormat,
|
||||||
|
},
|
||||||
tableData,
|
tableData,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue