Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve centroids #872

Merged
merged 110 commits into from
Jan 22, 2020
Merged

improve centroids #872

merged 110 commits into from
Jan 22, 2020

Conversation

seve
Copy link
Member

@seve seve commented Aug 6, 2019

This PR reintroduces centroids with a graph overlay which hosts labels marking centroids for each value within the current column colored by. These labels can be toggled on by clicking the new label button on the menubar and coloring by the desired column.

Jan-08-2020 15-32-03


This PR implements the following changes:

  • New components and React refactoring
    • client/src/components/graph/overlays/graphOverlayLayer.js
      • A new component that houses all the logic to mutate overlays in parallel with any camera movement
    • client/src/components/graph/overlays/centroidLabels.js
      • A new component which contains all the logic around creating and maintaining the centroid labels
    • client/src/components/graph/graph.js
      • Implementation of the graph overlay layer and centroid labels
      • General refactoring to move logic out of component
    • client/src/components/graph/setupCentroidSVG.js
      • Removal of the file in favor of the label component
    • client/src/components/graph/setupLasso.js
      • Added the lasso-svg class to lasso related SVGs for easier DOM management
    • client/src/components/graph/setupSVGandBrush.js
      • Removed the creation of the lasso layer in favor of a more simple catch-all graph SVG layer
    • client/src/components/menubar/index.js
      • Created the centroid label toggle button
  • Redux store additions/changes
    • client/src/reducers/centroidLabels.js
      • Creation of reducer to manager label state
    • client/src/reducers/index.js
      • Include new reducer
    • client/src/actions/index.js
      • Add resetting centroid labels to the list of actions performed on reset
    • client/src/reducers/undoableConfig.js
    • Add centroid reducer to necessary actions sets
    • client/src/reducers/centroidLabel.js → client/src/reducers/pointDilation.js
      • Repurposing of old centroid reducer for dilation use
    • client/src/components/scatterplot/scatterplot.js
      • Updated scatterplot to use correct store
  • Misc.
    • client/src/util/centroid.js
      • Rewrote calcMedianCentroid() to calculate all coordinates instead of a single value's
    • client/src/components/categorical/value.js
      • Added logic to allow inverse dilation (hover on label results in the hover style on the lsb)

@seve seve force-pushed the seve/enhancement-improve-centroids branch 3 times, most recently from 6e4688a to 711ab3a Compare August 16, 2019 00:12
@bkmartinjr bkmartinjr added this to the 0.13.0 milestone Oct 1, 2019
@bkmartinjr bkmartinjr modified the milestones: 0.13.0, 0.14.0 Nov 19, 2019
@seve seve force-pushed the seve/enhancement-improve-centroids branch from 44e2323 to 38a8aa5 Compare December 11, 2019 02:28
@seve seve force-pushed the seve/enhancement-improve-centroids branch from 57be1de to 71659a4 Compare January 8, 2020 22:48
@seve seve changed the title [WIP]improve centroids improve centroids Jan 9, 2020
@seve seve changed the title improve centroids [WIP] improve centroids Jan 9, 2020
@seve seve changed the title [WIP] improve centroids improve centroids Jan 14, 2020
@seve seve force-pushed the seve/enhancement-improve-centroids branch from 12ade4b to f39c405 Compare January 14, 2020 00:42
// If the category is truncated and this value is removed,
// it will not be assigned a category value and will not be
// labeled on the graph
const categoryValueIndex = categoricalSelection[
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be optimized significantly if you pull all of this setup code, which does not change as you iterate through the loop, out into a setup pass. Use the schema - it has all of the information already in it.

I think the following lines could be done once, rather than for each row/cell: lines 38-63

Copy link
Contributor

Choose a reason for hiding this comment

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

Per our offline conversation, this optimization can be done as a later PR (ie, land this thing!) Please make sure you capture in an issue, linked from this PR, so we don't forget about it.

@seve seve force-pushed the seve/enhancement-improve-centroids branch from 59772aa to e437896 Compare January 22, 2020 21:33
@seve seve merged commit 8d725b1 into master Jan 22, 2020
@colinmegill colinmegill deleted the seve/enhancement-improve-centroids branch January 22, 2020 22:08
bmccandless pushed a commit that referenced this pull request Jan 22, 2020
* refactor reducer to no longer support hover state and hold many labels

* refactor to generate centroidCoordinates for all values of a category

* create hash for function and memoize export

* create button to display all labels for a category

* clear state

* create label for each thing

* calculate on each value

* change to in place modification of map

* switch to for loop with iterator instead of forEach

* use map from centroidLabel instead of creating copy

* adapt for map

* utilize tarrays

* begin documentation

* disable centroids if in zoom mode

* clean up

* persist uncalc coordinates

* document

* clean up and document

* cleanup and document

* fix

* fix undefined labels and document changes

* fix first element skip

* fix conditional recalc

* rename centroidLabel -> centroidLabels

* break out dilation on hover to new reducer

* numerous styling changes for readability

* change centroid icon

* remove colorAccessor from parameters

* recalc centroids on world change

* make label toggle undoable

* remove unused import

* highlight labels on hover

* remove special characters from svg id

* lighten backdrop

* only generate new centroids if they pre-exist

* fix issue with spaces in catagorical value name

* add label buttons to menubar

* change reducer to use colorAccessor and have single toggle

* fix check to see if svg should be rendered

* move svg overlays onto a single svg layer

* dilate on label hover

* remove logs

* allow centroid to update along side regl renders

* allow actions to pass through svg if in zoom mode

* remove artifact from circle

* remove comment

* remove disabling of centroid button

* fix conditional map to screen

* make styling label conditions stricter

* prettier

* refactor onto master

* refactor computePointFlags() to use pointDilation store

* notify when viewport changes

* move svg attributes out of lasso setup and prevent rerenders/writes

* begin playing with transform matrix

* first solution for camera interaction

* create transform using nested groups

* semi-working method using nested groups with transforms

* inversely scale text

* properly do final transform

* cleanup dead / test code

* reinstate original functionality

* breakout centroid labels labels into separate component

* default toggle on for testing

* separate lasso and centroid layers

* remove unnecessary attributes, working hover

* dilation on label hover

* fix dilation on scatterplot

* add dilation on label hover

* break overlay into separate component

* make overlay agnostic to children

* move label mouse actions to centroidlabels component, add overlay state

* remove lasso on switch to camera

* disallow user selection

* fix reducer

* fix subset with continuous color error

* reset labels on color by continuous

* revert centroids on by default

* refactor for nested restructuring

* remove update checking

* remove unused method

* readd deleted hover delay

* remove old centroid setup

* remove centroid from undoable

* cleanup dead code

* remove dead code

* rollback unnecessary changes

* begin adding annotation functionality

* add annotation functionality

* add reset and undo functionality

* change centroids on layout change

* don't create label for unassigned

* add comment pointing out POI for performance

* touch up matrix transform comment

* add comment explaining coordinate space and children's assumed space

* remove dead code

* switch to pure component

* connect centroidLabels to redux

* clean up camera check and null result

* tool tip change

* rename centroid toggle and the like

* fix the misalignment of buttons, also make blueprint use consistent

* fix comment spelling mistakes

* introduce variable for cleaner logic expressions and state assignment

* alter tooltip text to back color by interaction

* remove manual iterator manipulation for forEach()

* remove debounce

* nit fix

* tooltip wording fix

* lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants