Skip to content

Commit

Permalink
Merge pull request #110 from Kanaries/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ObservedObserver committed Sep 2, 2022
2 parents 025dd25 + 85cbac4 commit 37be361
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 16 deletions.
8 changes: 7 additions & 1 deletion packages/rath-client/public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,17 @@
"methods": {
"dropNull": "drop null records",
"useMode": "replace null with mode",
"simpleClean": "simple cleaning",
"simpleClean": "use zero or null",
"none": "none(use original data)"
},
"tip": "Remember to adjust the fields' types and cleaning strategy before analysis.",
"recordCount": "Number of records {count}",
"rowsInViews": "Origin: {origin} rows / Select: ({select}) / Clean: ({clean}) rows",
"selection": {
"title": "Fast Selection Config",
"desc": "Filter based on quantiles to get the main part of your data.",
"syncMode": "sync mode"
},
"upload": {
"title": "Upload Your own dataset",
"fileTypes": "csv, json are supportted.",
Expand Down
8 changes: 7 additions & 1 deletion packages/rath-client/public/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,17 @@
"methods": {
"dropNull": "删除空值记录",
"useMode": "使用众数代替空",
"simpleClean": "简单的替换",
"simpleClean": "替换为0或null",
"none": "无(使用原始数据)"
},
"tip": "记得在开始分析前先调整数据的清洗策略并配置字段的属性",
"recordCount": "记录数 {count}",
"rowsInViews": "原始数据: {origin} 行 / 筛选后: {select} 行 / 清洗后: {clean} 行",
"selection": {
"title": "快速数据筛选",
"desc": "基于数据中的分位数进行快速筛选",
"syncMode": "分位数同步"
},
"upload": {
"title": "连接你的数据集,根据需求调整以下配置",
"fileTypes": "支持csv, json文件",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { observer } from 'mobx-react-lite';
import { DefaultButton, Modal, PrimaryButton, Slider, Stack, Toggle } from 'office-ui-fabric-react';
import React, { useCallback, useEffect, useState } from 'react';
import { observer } from 'mobx-react-lite';
import { DefaultButton, Label, Modal, PrimaryButton, Slider, Stack, Toggle } from 'office-ui-fabric-react';
import intl from 'react-intl-universal';
import { useGlobalStore } from '../../../store';

const FastSelection: React.FC = () => {
Expand Down Expand Up @@ -30,9 +31,9 @@ const FastSelection: React.FC = () => {
dataSourceStore.setShowFastSelection(false);
}}>
<div style={{ padding: '2em' }}>
<h1>Fast Selection Config</h1>
<p>Filter based on quantiles to get the main part of your data.</p>
<Toggle label="sync mode" checked={syncMode}
<Label>{intl.get('dataSource.selection.title')}</Label>
<p>{intl.get('dataSource.selection.desc')}</p>
<Toggle label={intl.get('dataSource.selection.syncMode')} checked={syncMode}
onChange={(_, checked) => {
setSyncMode(Boolean(checked))
}}
Expand All @@ -53,14 +54,14 @@ const FastSelection: React.FC = () => {
/>)
}
<Stack style={{ marginTop: '1em' }} horizontal>
<PrimaryButton text="Submit" onClick={() => {
<PrimaryButton text={intl.get('function.confirm')} onClick={() => {
dataSourceStore.createBatchFilterByQts(
meaFields.map(m => m.fid),
ranges
)
dataSourceStore.setShowFastSelection(false);
}} />
<DefaultButton style={{ marginLeft: '1em' }} text="Cancel" onClick={() => {
<DefaultButton style={{ marginLeft: '1em' }} text={intl.get('function.cancel')} onClick={() => {
dataSourceStore.setShowFastSelection(false);
}} />
</Stack>
Expand Down
2 changes: 1 addition & 1 deletion packages/rath-client/src/pages/dataSource/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const DataSourceBoard: React.FC<DataSourceBoardProps> = (props) => {
</Stack>
<i style={{ fontSize: 12, fontWeight: 300, color: '#595959' }}>
{intl.get('dataSource.recordCount', { count: cleanedData.length })} <br />
Origin: ({rawData.length}) rows / Selected: ({ filteredData.length }) / Clean: ({cleanedData.length}) rows
{intl.get('dataSource.rowsInViews', { origin: rawData.length, select: filteredData.length, clean: cleanedData.length })}
</i>
<Toggle checked={dataPreviewMode === IDataPreviewMode.meta}
disabled={rawData.length === 0}
Expand Down
3 changes: 1 addition & 2 deletions packages/rath-client/src/pages/semiAutomation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ const PatternPage: React.FC = () => {
const { discoveryMainStore } = useGlobalStore();
const {
fieldMetas,
dataSource,
dataSource
} = discoveryMainStore;

useEffect(() => {
if (dataSource.length > 1e5) {
discoveryMainStore.updateSettings('vizAlgo', 'lite')
}
discoveryMainStore.initAssociate();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [fieldMetas, dataSource])

Expand Down
4 changes: 1 addition & 3 deletions packages/rath-client/src/queries/distribution/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ export function autoMark (fields: IFieldMeta[], statFields: IFieldMeta[]= [], or
} else if (isSetEqual(semantics, ['quantitative', 'quantitative'])) {
return 'area'
} else if (isSetEqual(semantics, ['temporal', 'quantitative'])) {
const temporalField = semanticFields.find(s => s.semanticType === 'temporal')!;
if (temporalField.features.unique > 16) return 'line'
return 'bar'
return 'line'
}
} else {
if (isSetEqual(semantics, ['nominal', 'nominal'])) {
Expand Down
4 changes: 3 additions & 1 deletion packages/rath-client/src/store/discovery/mainStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export class DiscoveryMainStore {
!autoPatt && this.initRenderViews('featViews');
autoFilter && this.filterAssociate();
!autoFilter && this.initRenderViews('filterViews');
} else {
autoPatt && this.initAssociate();
}
}))

Expand Down Expand Up @@ -99,7 +101,7 @@ export class DiscoveryMainStore {
public setShowMiniFloatView (show: boolean) {
this.showMiniFloatView = show;
}
public hasMainView () {
public get hasMainView () {
return this.mainView !== null
}
public get dataSource () {
Expand Down

0 comments on commit 37be361

Please sign in to comment.