Skip to content

Commit

Permalink
Merge pull request #1139 from merico-dev/1138-remove-the-scroll-and-b…
Browse files Browse the repository at this point in the history
…order-from-merico-heatmap

1138 remove the scroll and border from merico heatmap
  • Loading branch information
GerilLeto authored Aug 22, 2023
2 parents ec98f9d + 30b7e02 commit 6c56726
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 37 deletions.
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": "10.21.0",
"version": "10.22.0",
"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": "10.21.0",
"version": "10.22.0",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { getOption } from './option';
import { ClickHeatBlock } from '../triggers';
import { DEFAULT_CONFIG, TMericoHeatmapConf } from '../type';

const MERICO_HEATMAP_UNIT_SIZE = 25;
interface IClickHeatBlock {
type: 'click';
seriesType: 'heatblock';
Expand Down Expand Up @@ -88,39 +87,19 @@ function Chart({
return getOption(conf, data, variables);
}, [conf, data]);

const size = useMemo(() => {
const ret = {
w: width,
h: height,
};
try {
const xCount = option.xAxis?.data.length ?? 0;
const yCount = option.yAxis?.data.length ?? 0;
ret.w = Math.max(ret.w, xCount * MERICO_HEATMAP_UNIT_SIZE);
ret.h = Math.max(ret.h, yCount * MERICO_HEATMAP_UNIT_SIZE);
} catch (error) {
console.error(error);
}
return ret;
}, [width, height, option]);

if (!width || !height) {
return null;
}
console.log({ size, width, height });

return (
<ScrollArea w={width} h={height} type="auto" pr={size.w > width ? '13px' : 0} pb={size.h > height ? '15px' : 0}>
<Box w={size.w} h={size.h} pb={size.h > height ? '15px' : 0}>
<ReactEChartsCore
echarts={echarts}
option={option}
style={{ width: '100%', height: '100%' }}
onEvents={onEvents}
notMerge
theme="merico-light"
/>
</Box>
</ScrollArea>
<ReactEChartsCore
echarts={echarts}
option={option}
style={{ width, height }}
onEvents={onEvents}
notMerge
theme="merico-light"
/>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export function getSeries(conf: TMericoHeatmapConf, data: TPanelData) {
yAxisIndex: 0,
datasetIndex: 0,
itemStyle: {
borderColor: 'white',
borderWidth: 2,
borderWidth: 0,
},
data: seriesData,
label: heat_block.label,
Expand Down
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": "10.21.0",
"version": "10.22.0",
"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": "10.21.0",
"version": "10.22.0",
"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": "10.21.0",
"version": "10.22.0",
"scripts": {
"dev": "vite",
"preview": "vite preview"
Expand Down

0 comments on commit 6c56726

Please sign in to comment.