Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1587 unexpected pie in pie charts tooltip #1588

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtable/api",
"version": "14.3.1",
"version": "14.3.2",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtable/dashboard",
"version": "14.3.1",
"version": "14.3.2",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { defaultEchartsOptions } from '~/styles/default-echarts-options';
import { IPieChartConf } from '../type';
import { getSeries } from './series';
import { getTooltip } from './tooltip';

export function getOption(conf: IPieChartConf, data: TPanelData, width: number) {
return {
tooltip: defaultEchartsOptions.getTooltip({}),
tooltip: getTooltip(),
series: getSeries(conf, data, width),
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { defaultEchartsOptions } from '~/styles/default-echarts-options';

function getFormatter() {
return ({ name, value, color }: any) => {
const template = `
<table style="width: auto">
<thead>
<tr colspan="2">
<div style="
width: 100%; height: 4px; border-radius: 2px; margin-bottom: 6px;
background-color: ${color};"
/>
</tr>
</thead>
<tbody>
<tr>
<th style="text-align: right; padding: 0 1em;">${name}</th>
<td style="text-align: left; padding: 0 1em;">${value}</td>
</tr>
</tbody>
</table>
`;

return template;
};
}

export function getTooltip() {
return defaultEchartsOptions.getTooltip({
trigger: 'item',
formatter: getFormatter(),
});
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtable/root",
"version": "14.3.1",
"version": "14.3.2",
"private": true,
"workspaces": [
"api",
Expand Down
2 changes: 1 addition & 1 deletion settings-form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtable/settings-form",
"version": "14.3.1",
"version": "14.3.2",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@devtable/website",
"private": true,
"license": "Apache-2.0",
"version": "14.3.1",
"version": "14.3.2",
"scripts": {
"dev": "vite",
"preview": "vite preview"
Expand Down
Loading