Skip to content

Commit e44a253

Browse files
authored
Merge pull request #489 from devforth/next
Next
2 parents 9a464e7 + 80ac772 commit e44a253

File tree

23 files changed

+1267
-30
lines changed

23 files changed

+1267
-30
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules
22
plugins/*
33
!plugins/install-plugins.sh
44
adapters/*
5-
!adapters/install-adapters.sh
5+
!adapters/install-adapters.sh
6+
background-jobs-dbs

adminforth/documentation/docs/tutorial/03-Customization/15-afcl.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,8 +2120,87 @@ import { PieChart } from '@/afcl'
21202120
</div>
21212121
</div>
21222122

2123+
## Treemap Chart
2124+
2125+
This example is based on the ApexCharts treemap demo “color range”.
2126+
2127+
<div class="split-screen" >
2128+
<div >
2129+
2130+
```ts
2131+
import { TreeMapChart } from '@/afcl'
2132+
2133+
const deltaToColor = (delta: number) => {
2134+
if (delta < -10) return '#B91C1C' // bright red
2135+
if (delta < 0) return '#EF4444' // red
2136+
if (delta <= 10) return '#22C55E' // green
2137+
return '#15803D' // very green
2138+
}
2139+
2140+
const formatDelta = (delta: number) => (delta > 0 ? `+${delta}%` : `${delta}%`)
2141+
2142+
const data = [
2143+
{ x: 'New Delhi', value: 218, delta: 12 },
2144+
{ x: 'Kolkata', value: 149, delta: -4 },
2145+
{ x: 'Mumbai', value: 184, delta: -14 },
2146+
{ x: 'Ahmedabad', value: 55, delta: 6 },
2147+
{ x: 'Bangalore', value: 84, delta: 9 },
2148+
{ x: 'Pune', value: 31, delta: -2 },
2149+
{ x: 'Chennai', value: 70, delta: 0 }
2150+
]
2151+
2152+
// Optional: precompute per-point color using delta
2153+
const dataWithColors = data.map((item) => ({
2154+
...item,
2155+
fillColor: deltaToColor(item.delta),
2156+
}))
2157+
2158+
const series = [
2159+
{ name: 'Desktops', fieldName: 'value' },
2160+
]
2161+
```
2162+
2163+
```html
2164+
<TreeMapChart
2165+
:data="dataWithColors"
2166+
:series="series"
2167+
:options="{
2168+
chart: { height: 350 },
2169+
dataLabels: {
2170+
formatter: (text, { seriesIndex, dataPointIndex, w }) => {
2171+
const point = w?.config?.series?.[seriesIndex]?.data?.[dataPointIndex]
2172+
if (!point) return text
2173+
return `${text} ${formatDelta(point.delta)}`
2174+
},
2175+
},
2176+
plotOptions: {
2177+
treemap: {
2178+
distributed: false,
2179+
enableShades: false,
2180+
},
2181+
},
2182+
tooltip: {
2183+
y: {
2184+
formatter: (value, { seriesIndex, dataPointIndex, w }) => {
2185+
const point = w?.config?.series?.[seriesIndex]?.data?.[dataPointIndex]
2186+
if (!point) return value
2187+
return `${point.value} (${formatDelta(point.delta)})`
2188+
},
2189+
},
2190+
},
2191+
}"
2192+
/>
2193+
```
2194+
2195+
</div>
2196+
<div>
2197+
![Treemap Chart](image-28.png)
2198+
</div>
2199+
</div>
2200+
21232201
## Mixed Chart
21242202

2203+
21252204
```ts
21262205
import { MixedChart } from '@/afcl'
21272206
```
32.3 KB
Loading

0 commit comments

Comments
 (0)