|
1 | 1 | import { createTab } from "@api/chrome/tab" |
2 | | -import { getCssVariable, getPrimaryTextColor, getSecondaryTextColor } from "@pages/util/style" |
| 2 | +import { getCssVariable, getInfoColor, getPrimaryTextColor, getSecondaryTextColor } from "@pages/util/style" |
3 | 3 | import { calJumpUrl } from "@popup/common" |
4 | 4 | import { t } from "@popup/locale" |
5 | 5 | import { sum, toMap } from "@util/array" |
@@ -204,23 +204,22 @@ export function generateSiteSeriesOption(rows: timer.stat.Row[], result: Percent |
204 | 204 | const chartRows = cvt2ChartRows(rows, dimension, itemCount) |
205 | 205 | const iconRich: PieLabelRichOption = {} |
206 | 206 | const data = chartRows.map(row => { |
207 | | - const value = row[dimension] |
208 | | - let name = 'NaN' |
| 207 | + const item: PieSeriesItemOption = { name: 'NaN', value: row[dimension], row } |
209 | 208 | if (isOther(row)) { |
210 | | - const { count } = row |
211 | | - name = t(msg => msg.content.percentage.otherLabel, { count }) |
| 209 | + item.itemStyle = { color: getInfoColor() } |
| 210 | + item.name = t(msg => msg.content.percentage.otherLabel, { count: row.count }) |
212 | 211 | } else if (isSite(row)) { |
213 | 212 | const { siteKey, alias, iconUrl } = row |
214 | 213 | const { host } = siteKey || {} |
215 | | - name = (displaySiteName ? (alias ?? host) : host) ?? '' |
| 214 | + const name = item.name = (displaySiteName ? (alias ?? host) : host) ?? '' |
216 | 215 | const richValue: PieLabelRichValueOption = { ...BASE_LABEL_RICH_VALUE } |
217 | 216 | iconUrl && (richValue.backgroundColor = { image: iconUrl }) |
218 | 217 | iconRich[legend2LabelStyle(name)] = richValue |
219 | 218 | } else if (isGroup(row)) { |
220 | | - name = getGroupName(groupMap, row) |
| 219 | + item.name = getGroupName(groupMap, row) |
221 | 220 | } |
222 | 221 |
|
223 | | - return { name, value, row } satisfies PieSeriesItemOption |
| 222 | + return item |
224 | 223 | }) |
225 | 224 |
|
226 | 225 | const textColor = getPrimaryTextColor() |
|
0 commit comments