Skip to content

Commit

Permalink
diffs kinda working again!
Browse files Browse the repository at this point in the history
  • Loading branch information
billyc committed Jan 19, 2022
1 parent ddc998e commit faafd68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
24 changes: 3 additions & 21 deletions src/plugins/links-gl/LinkLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,14 @@ export default function Component({
build = {} as LookupDataset,
base = {} as LookupDataset,
widths = {} as LookupDataset,
// buildData = new Float32Array() as Float32Array | any[],
// baseData = new Float32Array() as Float32Array | any[],
showDiffs = false,
viewId = 0,
}) {
// ------- draw frame begins here -----------------------------

const { dataTable, activeColumn, joinColumn } = build
// console.log({ build })
const buildColumn: DataTableColumn = dataTable[activeColumn] || { values: [] }

// console.log({ buildColumn })

const globalMax = Math.max(
...Object.values(dataTable).map(column => {
return column.max || -Infinity
})
)

// const rows = buildData

// const [hoverInfo, setHoverInfo] = useState({})
// const [pickIndex, setPickIndex] = useState(-1)
const [viewState, setViewState] = useState(globalStore.state.viewState)
Expand Down Expand Up @@ -83,16 +70,11 @@ export default function Component({
let value = dataTable[activeColumn].values[objectInfo.index]
if (!value) return colorInvisible

// if (pickIndex > -1) console.log(feature)
// if (objectInfo.index === pickIndex) {
// return [255, 64, 255, 255]
// }

if (colors.length === 1) return rgbColors[0]

// comparison?
if (showDiffs) {
const baseValue = baseData[objectInfo.index]
const baseValue = base.dataTable[base.activeColumn].values[objectInfo.index]
const diff = value - baseValue

if (diff === 0) return colorPaleGrey // setColorBasedOnValue(0.5)
Expand All @@ -118,7 +100,7 @@ export default function Component({
const value = widthValues.values[objectInfo.index]

if (showDiffs) {
const baseValue = baseData[objectInfo.index]
const baseValue = base.dataTable[base.activeColumn].values[objectInfo.index]
const diff = Math.abs(value - baseValue)
return diff / scaleWidth
} else {
Expand Down Expand Up @@ -148,7 +130,7 @@ export default function Component({
let diff = undefined

if (showDiffs) {
baseValue = baseData[index]
const baseValue = base.dataTable[base.activeColumn].values[index]
diff = value - baseValue
} else {
if (value === undefined) return ''
Expand Down
1 change: 1 addition & 0 deletions src/plugins/links-gl/LinkVolumes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ class MyPlugin extends Vue {
// a fully-build DatasetDefinition, so let's just handle that
this.handleNewDataset(props.dataset)
}
console.log('VIZDETAILS', this.vizDetails)
}
private handleNewFilter(columns: number[]) {
Expand Down

0 comments on commit faafd68

Please sign in to comment.