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

feat: Implemented first draft of eChart Scatter Chart #65

Merged
merged 3 commits into from
Jul 15, 2022
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
25 changes: 25 additions & 0 deletions components/atoms/EChartWrapper/echart-wrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from "react";
import ReactECharts from "echarts-for-react";

/*
Docs for eChart: https://echarts.apache.org/en/feature.html
eChart Examples: https://echarts.apache.org/examples/en/editor.html?c=scatter-simple&lang=ts
Docs for ReactECharts: https://github.com/hustcc/echarts-for-react
*/

interface EChartWrapperProps {
option: Object;
}

const EChartWrapper: React.FC<EChartWrapperProps> = ({ option }) => {
return (
<ReactECharts
option={option}
notMerge={true}
lazyUpdate={true}
theme={"theme_name"}
/>
);
};

export default EChartWrapper;
32 changes: 32 additions & 0 deletions components/molecules/ScatterChart/scatter-chart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";
import Card from "components/atoms/Card/card";
import Text from "components/atoms/Typography/text";
import IconButton from "components/atoms/IconButton/icon-button";
import EChartWrapper from "components/atoms/EChartWrapper/echart-wrapper";

interface ScatterChartProps {
title: string;
option: Object;
}

const ScatterChart: React.FC<ScatterChartProps> = ({ title, option }) => {
return (
<Card>
<>
<div className="w-full flex justify-between">
<div>
<Text className="!text-light-slate-12 font-medium">
{title}
</Text>
</div>
<div>
<IconButton />
</div>
</div>
<EChartWrapper option={option} />
</>
</Card>
);
};

export default ScatterChart;
Loading