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: Update Scatter Chart Legend #260

Merged
merged 7 commits into from
Aug 31, 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React from "react";
import EChartWrapper from "components/atoms/EChartWrapper/echart-wrapper";
import ComponentHeader from "../ComponentHeader/component-header";

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

const ScatterChart: React.FC<ScatterChartProps> = ({ title, option }) => {
const DashboardScatterChart: React.FC<DashboardScatterChartProps> = ({ title, option }) => {
return (
<>
<ComponentHeader title={title} />
Expand All @@ -16,4 +16,4 @@ const ScatterChart: React.FC<ScatterChartProps> = ({ title, option }) => {
);
};

export default ScatterChart;
export default DashboardScatterChart;
4 changes: 2 additions & 2 deletions components/organisms/Dashboard/dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useDashBoardData from "lib/hooks/useDashboardData";
import Card from "../../atoms/Card/card";
import ScatterChart from "components/molecules/ScatterChart/scatter-chart";
import DashboardScatterChart from "components/molecules/DashboardScatterChart/dashboard-scatter-chart";
import HighlightCard from "components/molecules/HighlightCard/highlight-card";
import humanizeNumber from "lib/utils/humanizeNumber";

Expand Down Expand Up @@ -54,7 +54,7 @@ export const Dashboard = (): JSX.Element => {
<section className="flex flex-col lg:flex-row max-w-full gap-4 mb-6">
<div className="flex flex-col w-full gap-4">
<Card className="w-full p-5">
<ScatterChart title="Test Title" option={scatterOptions} />
<DashboardScatterChart title="Test Title" option={scatterOptions} />
</Card>
</div>
</section>
Expand Down
6 changes: 6 additions & 0 deletions stories/molecules/card-line-chart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ const storyConfig = {
export default storyConfig;

const testOptions = {
grid: {
left: 40,
top: 10,
right: 40,
bottom: 20
},
eryc-cc marked this conversation as resolved.
Show resolved Hide resolved
xAxis: {
type: "category",
boundaryGap: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,52 @@
import React from "react";
import { ComponentStory, ComponentMeta } from "@storybook/react";
import ScatterChart from "../../components/molecules/ScatterChart/scatter-chart";
import DashboardScatterChart from "../../components/molecules/DashboardScatterChart/dashboard-scatter-chart";

const storyConfig = {
title: "Design System/Molecules/Scatter Chart",
title: "Design System/Molecules/Dashboard Scatter Chart",
component: "ScatterChart"
};

export default storyConfig;

const testOptions = {
xAxis: {},
yAxis: {},
grid: {
left: 40,
top: 10,
right: 40,
bottom: 20
},
xAxis: {
boundaryGap: false,
scale: true,
minInterval: 7,
maxInterval: 7,
min: 0,
max: 35,
axisLabel: {
formatter: (value: number, index: number) => value === 0 ? "Today" : value === 35 ? "35+ days ago" : `${value} days ago`
},
splitLine: {
lineStyle: {
type: "dashed"
}
}
},
yAxis: {
min: 0,
max: 100,
splitNumber: 2,
boundaryGap: false,
axisLabel: {
showMinLabel: false,
formatter: "{value}%"
},
splitLine: {
lineStyle: {
type: "dashed"
}
}
},
series: [
{
symbolSize: 20,
Expand Down Expand Up @@ -45,8 +80,43 @@ const testOptions = {
};

const testOptionsWithImage = {
xAxis: {},
yAxis: {},
grid: {
left: 40,
top: 10,
right: 40,
bottom: 20
},
xAxis: {
boundaryGap: false,
scale: true,
minInterval: 7,
maxInterval: 7,
min: 0,
max: 35,
axisLabel: {
formatter: (value: number, index: number) => value === 0 ? "Today" : value === 35 ? "35+ days ago" : `${value} days ago`
},
splitLine: {
lineStyle: {
type: "dashed"
}
}
},
yAxis: {
min: 0,
max: 100,
splitNumber: 2,
boundaryGap: false,
axisLabel: {
showMinLabel: false,
formatter: "{value}%"
},
splitLine: {
lineStyle: {
type: "dashed"
}
}
},
series: [
{
symbolSize: 30,
Expand Down Expand Up @@ -81,7 +151,7 @@ const testOptionsWithImage = {
};

// ScatterChart Template
const ScatterChartTemplate: ComponentStory<typeof ScatterChart> = (args) => <ScatterChart {...args} />;
const ScatterChartTemplate: ComponentStory<typeof DashboardScatterChart> = (args) => <DashboardScatterChart {...args} />;

// ScatterChart Default
export const Default = ScatterChartTemplate.bind({});
Expand Down