Skip to content

Commit 9646cad

Browse files
committed
renaming varibles
1 parent ca80eea commit 9646cad

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

src/lib/components/data-vis/axis/Ticks.svelte

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,24 @@
1111
axisFunction,
1212
values,
1313
numberOfTicks,
14-
baseline,
15-
setMax,
14+
minTick,
15+
maxTick,
1616
orientation,
1717
yearsInput,
1818
generateTicksNum,
19+
yearFormating,
1920
} = $props();
2021
2122
$inspect(ticksArray);
2223
23-
function generateTicks(data, numTicks, baseline, setTick) {
24+
function generateTicks(data, numTicks, minTick, maxTick) {
2425
let minVal =
25-
baseline !== null
26-
? new Decimal(baseline)
26+
minTick !== null
27+
? new Decimal(minTick)
2728
: Decimal.min(...data.map((val) => new Decimal(val)));
2829
let maxVal =
29-
setTick !== null
30-
? new Decimal(setTick)
30+
maxTick !== null
31+
? new Decimal(maxTick)
3132
: Decimal.max(...data.map((val) => new Decimal(val)));
3233
let rangeVal = maxVal.minus(minVal);
3334
@@ -63,7 +64,7 @@
6364
6465
numberOfTicks = tickCount(chartWidth);
6566
66-
ticksArray = generateTicks(values, numberOfTicks, baseline, setMax);
67+
ticksArray = generateTicks(values, numberOfTicks, minTick, maxTick);
6768
let yearTicks = yearsInput ? yearsFormat(ticksArray) : [];
6869
</script>
6970

@@ -103,7 +104,7 @@
103104
: "start"}
104105
fill="black"
105106
>
106-
{yearsInput ? yearTicks[index] : `${prefix}${tick}${suffix}`}
107+
{yearsInput ? yearTicks[index] : "${prefix{tick}{suffix}"}
107108
</text>
108109
</g>
109110
{/each}

src/wrappers/components/data-vis/axis/TicksWrapper.svelte

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,15 @@
251251
{
252252
name: "prefix",
253253
category: "customisations",
254-
value: "number of",
254+
value: "",
255255
},
256256
{
257257
name: "suffix",
258258
category: "customisations",
259-
value: "%",
259+
value: "",
260260
},
261-
{ name: "baseline", category: "customisations", value: 0 },
262-
{ name: "setMax", category: "customisations", value: 100 },
261+
{ name: "minTick", category: "formatting", value: 0 },
262+
{ name: "maxTick", category: "formatting", value: 100 },
263263
{ name: "generateTicksNum", category: "customisations", value: false },
264264
{ name: "yearsInput", category: "customisations", value: false },
265265
{
@@ -280,6 +280,13 @@
280280
name: "orientation",
281281
category: "customisations",
282282
},
283+
{
284+
name: "yearFormating",
285+
category: "formatting",
286+
functionElements: {
287+
functionAsString: `function yearsFormat(ticks) {return ticks.map((tick) => "FY {tick % 100}-{(tick % 100) + 1}");}`,
288+
},
289+
},
283290
]),
284291
);
285292
@@ -356,7 +363,7 @@
356363
"scaleLinear()": scaleLinear(),
357364
"scaleLog()": scaleLog(),
358365
"scaleTime()": scaleTime(),
359-
}[getValue("yScaleType")]
366+
}[getValue("xyScaleType")]
360367
.domain([Math.min(...ticksArray), Math.max(...ticksArray)])
361368
.range([
362369
getValue("svgHeight") -
@@ -375,11 +382,16 @@
375382
orientation?.axis === "x" ? xFunction : yFunction,
376383
);
377384
385+
let yearFormating = $derived(function yearsFormat(ticks) {
386+
return ticks;
387+
});
388+
378389
let derivedParametersObject = $derived({
379390
chartWidth,
380391
chartHeight,
381392
orientation,
382393
axisFunction,
394+
yearFormating,
383395
});
384396
/**
385397
* DONOTTOUCH *

0 commit comments

Comments
 (0)