Skip to content

Commit

Permalink
fix: IsMaintained bar to line (#292)
Browse files Browse the repository at this point in the history
Signed-off-by: laixingyou <[email protected]>
  • Loading branch information
coder-sett authored Jan 3, 2024
1 parent f44ee90 commit dee063f
Showing 1 changed file with 16 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import React from 'react';
import {
getBarOption,
bar,
getTooltipsFormatter,
legendFormat,
getColorWithLabel,
} from '@common/options';
import useGetLineOption from '@modules/analyze/hooks/useGetLineOption';
import { CollaborationDevelopment } from '@modules/analyze/components/SideBar/config';
import BaseCard from '@common/components/BaseCard';
import ChartWithData from '@modules/analyze/components/ChartWithData';
import EChartX from '@common/components/EChartX';
import { useTranslation } from 'next-i18next';
import { GenChartOptions } from '@modules/analyze/type';
import CardDropDownMenu from '@modules/analyze/components/CardDropDownMenu';

const IsMaintained = () => {
Expand All @@ -23,29 +16,15 @@ const IsMaintained = () => {
yKey: 'metricCodequality.isMaintained',
summaryKey: 'summaryCodequality.isMaintained',
};
const getOptions: GenChartOptions = (
{ xAxis, compareLabels, yResults },
theme
) => {
const series = yResults.map(({ label, level, data }) => {
const color = getColorWithLabel(theme, label);
return bar({
name: label,
data: data,
color,
});
});

return getBarOption({
xAxisData: xAxis,
series,
legend: legendFormat(compareLabels),
tooltip: {
formatter: getTooltipsFormatter({ compareLabels }),
},
});
};

const {
getOptions,
showAvg,
showMedian,
setShowAvg,
setShowMedian,
yAxisScale,
setYAxisScale,
} = useGetLineOption();
return (
<BaseCard
title={t(
Expand All @@ -72,12 +51,16 @@ const IsMaintained = () => {
}
headRight={(ref, fullScreen, setFullScreen) => (
<CardDropDownMenu
enableLineSettingSwitch={false}
enableReferenceLineSwitch={false}
fullScreen={fullScreen}
onFullScreen={(b) => {
setFullScreen(b);
}}
showAvg={showAvg}
onAvgChange={(b) => setShowAvg(b)}
showMedian={showMedian}
onMedianChange={(b) => setShowMedian(b)}
yAxisScale={yAxisScale}
onYAxisScaleChange={(b) => setYAxisScale(b)}
cardRef={ref}
yKey={tansOpt['yKey']}
/>
Expand Down

2 comments on commit dee063f

@vercel
Copy link

@vercel vercel bot commented on dee063f Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on dee063f Jan 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.