Skip to content

Commit

Permalink
refactor:删除不必要的注释,美化代码 (#15)
Browse files Browse the repository at this point in the history
Signed-off-by: hongtenglong <[email protected]>
Co-authored-by: hongtenglong <[email protected]>
  • Loading branch information
tenglonghh and hongtenglong authored Sep 3, 2024
1 parent 26f8070 commit 324433c
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 68 deletions.
2 changes: 1 addition & 1 deletion harmony/charts-wrapper/Index.ets
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export * from './src/main/ets/BarCharts'
export * from './src/main/ets/LineCharts'
export * from './src/main/ets/HorizontalBarCharts'
export * from './src/main/ets/BubbleCharts'
export * from './src/main/ets/PieChart'
export * from './src/main/ets/PieCharts'
export * from './src/main/ets/RadarCharts'
export * from './src/main/ets/ScatterCharts'
export * from './src/main/ets/CandleStickCharts'
Expand Down
14 changes: 0 additions & 14 deletions harmony/charts-wrapper/src/main/ets/AxisBase.ets
Original file line number Diff line number Diff line change
Expand Up @@ -473,18 +473,4 @@ export const setAxis =
axis?.setCenterAxisLabels(xAxis?.centerAxisLabels)
}
}

//参数有问题
// if(props.xAxis?.fontFamily){
// axis?.setTypeface(props.xAxis.fontFamily);
// }


//ohos Charts未支持 LargeValueFormatter
// if(props.xAxis?.valueFormatter){
// let valueForMatter = props.xAxis.valueFormatter;
// // axis?.setValueFormatter(new LargeValueFormatter())
// }
//since 未找到
//timeUnit 未找到
}
3 changes: 0 additions & 3 deletions harmony/charts-wrapper/src/main/ets/BaseCharts.ets
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ export const setBaseProps =
legend?.setDirection(LegendDirection.LEFT_TO_RIGHT);
}

// 参数有差异
// legend.setTypeface(props.legend?.fontFamily)\

//设置图例形式的形式/形状 from
if (props.legend?.form === "NONE") {
legend?.setForm(LegendForm.NONE);
Expand Down
5 changes: 0 additions & 5 deletions harmony/charts-wrapper/src/main/ets/Data/BubbleData.ets
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ export const setBubbleData = (isBubble: string, descriptorWrapper: RNC.RNBubbleC
if (config?.visible != undefined) {
dataSet.setVisible(config.visible);
}
// 参数有点问题 valueFormatter
// if(config?.valueFormatter === 'largeValue'){
// dataSet.setValueFormatter(IValueFormatter);
//
// }

//设置轴依赖关系 axisDependency
if (config?.axisDependency === 'LEFT') {
Expand Down
14 changes: 2 additions & 12 deletions harmony/charts-wrapper/src/main/ets/Data/LineData.ets
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ export const setLineData = (isLine: string, descriptorWrapper: RNC.RNLineChart.D
ComDescriptorWrapper?: RNC.RNCombinedChart.DescriptorWrapper, CombinedData?: CombinedData): LineData | null => {

let dataSetList: JArrayList<ILineDataSet> = new JArrayList<ILineDataSet>();
let values: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
let label: string | undefined


if (descriptorWrapper && isLine === 'Line') {
let dataSetProps = descriptorWrapper.props.data;
dataSetProps.dataSets?.forEach((data) => {
let values: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
data.values?.forEach((v) => {
values.add(new EntryOhos(v.x, v.y));
})
Expand Down Expand Up @@ -178,18 +178,13 @@ export const setLineData = (isLine: string, descriptorWrapper: RNC.RNLineChart.D
dataSet.setDrawHighlightIndicators(config?.drawHighlightIndicators)
}

// if(config?.fillGradient!=undefined){
//
// }

// dataSet.setGradientFillColor(gradientFillColor)


dataSetList.add(dataSet);
})
} else {
let dataSetComProps = ComDescriptorWrapper?.props.data?.lineData
dataSetComProps?.dataSets?.forEach((data) => {
let values: JArrayList<EntryOhos> = new JArrayList<EntryOhos>();
data.values?.forEach((v) => {
values.add(new EntryOhos(v.x, v.y));
})
Expand Down Expand Up @@ -322,11 +317,6 @@ export const setLineData = (isLine: string, descriptorWrapper: RNC.RNLineChart.D
dataSet.setDrawHighlightIndicators(config?.drawHighlightIndicators)
}

// if(config?.fillGradient!=undefined){
//
// }

// dataSet.setGradientFillColor(gradientFillColor)


dataSetList.add(dataSet);
Expand Down
21 changes: 0 additions & 21 deletions harmony/charts-wrapper/src/main/ets/Data/PieData.ets
Original file line number Diff line number Diff line change
Expand Up @@ -152,27 +152,6 @@ export const setPieData = (descriptorWrapper: RNC.RNPieChart.DescriptorWrapper):
dataSet.setValueLineVariableLength(config.valueLineVariableLength);
}

//添加颜色
let colors: JArrayList<number> = new JArrayList();
for (let index = 0; index < ColorTemplate.VORDIPLOM_COLORS.length; index++) {
colors.add(ColorTemplate.VORDIPLOM_COLORS[index]);
}

for (let index = 0; index < ColorTemplate.JOYFUL_COLORS.length; index++) {
colors.add(ColorTemplate.JOYFUL_COLORS[index]);
}

for (let index = 0; index < ColorTemplate.COLORFUL_COLORS.length; index++) {
colors.add(ColorTemplate.COLORFUL_COLORS[index]);
}
for (let index = 0; index < ColorTemplate.LIBERTY_COLORS.length; index++) {
colors.add(ColorTemplate.LIBERTY_COLORS[index]);
}
for (let index = 0; index < ColorTemplate.PASTEL_COLORS.length; index++) {
colors.add(ColorTemplate.PASTEL_COLORS[index]);
}
colors.add(ColorTemplate.getHoloBlue());
dataSet.setColorsByList(colors);

})
let pieData = new PieData(dataSet)
Expand Down
12 changes: 5 additions & 7 deletions harmony/charts-wrapper/src/main/ets/Data/RadarData.ets
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
*/


import { AxisDependency, IRadarDataSet, JArrayList, RadarData, RadarDataSet, RadarEntry } from '@ohos/mpchart';
import {
AxisBase,
AxisDependency,
IAxisValueFormatter,
IRadarDataSet, JArrayList, RadarData, RadarDataSet, RadarEntry } from '@ohos/mpchart';
import { RNC } from '@rnoh/react-native-openharmony/generated';

export const setRadarData = (descriptorWrapper: RNC.RNRadarChart.DescriptorWrapper): RadarData | null => {
//判断Props data 是否为空
if (!descriptorWrapper.props.data) {
Expand Down Expand Up @@ -79,11 +82,6 @@ export const setRadarData = (descriptorWrapper: RNC.RNRadarChart.DescriptorWrapp
if (config?.visible != undefined) {
dataSet.setVisible(config.visible);
}
// 参数有点问题 valueFormatter
// if(config?.valueFormatter === 'largeValue'){
// dataSet.setValueFormatter(IValueFormatter);
//
// }

//设置轴依赖关系 axisDependency
if (config?.axisDependency === 'LEFT') {
Expand Down
5 changes: 0 additions & 5 deletions harmony/charts-wrapper/src/main/ets/Data/ScatterData.ets
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,6 @@ export const setScatterData = (isScatter: string, descriptorWrapper: RNC.RNScatt
if (config?.visible != undefined) {
dataSet.setVisible(config.visible);
}
// 参数有点问题 valueFormatter
// if(config?.valueFormatter === 'largeValue'){
// dataSet.setValueFormatter(IValueFormatter);
//
// }

//设置轴依赖关系 axisDependency
if (config?.axisDependency === 'LEFT') {
Expand Down

0 comments on commit 324433c

Please sign in to comment.