-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: association in v2 engine (new algo)
- Loading branch information
1 parent
5013547
commit 284413a
Showing
11 changed files
with
382 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"port": 2333, | ||
"clickhouse": { | ||
"protocol": "http:", | ||
"protocol": "http", | ||
"host": "localhost", | ||
"port": 8123 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React from "react"; | ||
// import VisDescription from "../../../plugins/visSummary/description"; | ||
// import useDigDimension, { DigDimensionProps } from "./digDimension"; | ||
import BaseChart from "../../../visBuilder/vegaBase"; | ||
import { FieldSummary, Subspace } from "../../../service"; | ||
// import { IconButton, Stack } from "office-ui-fabric-react"; | ||
import { IInsightSpace, Specification } from "visual-insights"; | ||
import { PreferencePanelConfig } from "../../../components/preference"; | ||
import { IRow } from "../../../interfaces"; | ||
|
||
export interface IVizSpace extends IInsightSpace { | ||
schema: Specification; | ||
dataView: IRow[] | ||
} | ||
|
||
interface AssociationProps { | ||
visualConfig: PreferencePanelConfig; | ||
// subspaceList: Subspace[]; | ||
vizList: IVizSpace[]; | ||
fieldScores: FieldSummary[]; | ||
dataSource: IRow[]; | ||
onSelectView: (index: number) => void | ||
} | ||
const AssociationCharts: React.FC<AssociationProps> = props => { | ||
const { vizList, onSelectView, visualConfig, fieldScores, dataSource } = props; | ||
// const { dataSource, fieldScores } = digDimensionProps; | ||
// const relatedCharts = useDigDimension(digDimensionProps); | ||
const fieldFeatures = fieldScores.map(f => ({ | ||
name: f.fieldName, | ||
type: f.type | ||
})); | ||
//className="ms-Grid" | ||
return ( | ||
<div style={{ border: "solid 1px #bfbfbf", marginTop: '2em' }}> | ||
|
||
<div style={{ display: 'flex', flexWrap: 'wrap', overflow: 'auto' }}> | ||
{vizList.map((view, i) => { | ||
return ( | ||
<div key={`associate-row-${i}`} | ||
// className="ms-Grid-row" | ||
dir="ltr" | ||
style={{ | ||
// border: "solid 1px #bfbfbf", | ||
margin: "1em", | ||
padding: "1em" | ||
}} | ||
> | ||
<BaseChart | ||
fixedWidth={false} | ||
aggregator={visualConfig.aggregator} | ||
defaultAggregated={view.schema.geomType && view.schema.geomType.includes("point") ? false : true} | ||
defaultStack={visualConfig.defaultStack} | ||
dimensions={view.dimensions} | ||
measures={view.measures} | ||
dataSource={dataSource} | ||
schema={view.schema} | ||
fieldFeatures={fieldFeatures} | ||
/> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AssociationCharts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { toJS } from 'mobx'; | ||
import { observer } from 'mobx-react-lite'; | ||
import React from 'react'; | ||
import { FieldSummary } from '../../../service'; | ||
import { useGlobalStore } from '../../../store'; | ||
import Association from './assCharts'; | ||
|
||
const ObservableAssociation: React.FC = props => { | ||
const { galleryStore, exploreStore } = useGlobalStore() | ||
const { dataSource, insightSpaces, fields, assoListT1, assoListT2 } = exploreStore; | ||
const { visualConfig } = galleryStore; | ||
|
||
const fieldScores: FieldSummary[] = fields.map(f => { | ||
const distribution = [...f.domain.entries()].map(c => ({ | ||
memberName: c[0], | ||
count: c[1] | ||
})) | ||
return ({ | ||
fieldName: f.key, | ||
distribution, | ||
entropy: f.features.entropy, | ||
maxEntropy: f.features.maxEntropy, | ||
type: f.semanticType | ||
}) | ||
}) | ||
|
||
const viewSpaces = insightSpaces.map((space, i) => ({ | ||
...space, | ||
score: typeof space.score === 'number' ? space.score : 0, | ||
index: i | ||
})) | ||
|
||
return <div> | ||
asso content {assoListT1.length} + {assoListT2.length} | ||
<Association | ||
onSelectView={(index) => { | ||
let pos = viewSpaces.findIndex((v) => v.index === index) | ||
if (pos > -1) { | ||
// galleryStore.goToPage(pos) | ||
// tmpStore. | ||
} | ||
}} | ||
dataSource={dataSource} | ||
visualConfig={toJS(visualConfig)} | ||
fieldScores={fieldScores} | ||
vizList={assoListT2.slice(0, 5)} | ||
/> | ||
<Association | ||
onSelectView={(index) => { | ||
let pos = viewSpaces.findIndex((v) => v.index === index) | ||
if (pos > -1) { | ||
// galleryStore.goToPage(pos) | ||
// tmpStore. | ||
} | ||
}} | ||
dataSource={dataSource} | ||
visualConfig={toJS(visualConfig)} | ||
fieldScores={fieldScores} | ||
vizList={assoListT1.slice(0, 5)} | ||
/> | ||
</div> | ||
} | ||
|
||
export default observer(ObservableAssociation); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.