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

Add step labeling to sankey #73

Merged
merged 9 commits into from
May 31, 2018
Merged

Conversation

krissalvador27
Copy link
Contributor

Adds step labeling to Sankey. Users must opt in to have labels show up

screen shot 2018-05-30 at 2 19 40 pm

@krissalvador27
Copy link
Contributor Author

the repeated commits might be due to me rebasing after I had already pushed this branch up.. will be squashed and merged anyway so shouldn't affect anything

Copy link
Contributor

@joshbDev joshbDev left a comment

Choose a reason for hiding this comment

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

small notes but lgtm


                       _____|\
                  _.--| SSt |:
                 <____|.----||
                        .---''---,
                         ;..__..'    _...
                       ,'/  ;|/..--''    \
                     ,'_/.-/':            :
                _..-'''/  /  |  \    \   _|/|
               \      /-./_ \;   \    \,;'   \
               ,\    / \:  `:\    \   //    `:`.
             ,'  \  /-._;   | :    : ::    ,.   .
           ,'     ::   /`-._| |    | || ' :  `.`.)
        _,'       |;._:: |  | |    | `|   :    `'
      ,'   `.     /   |`-:_ ; |    |  |  : \
      `--.   )   /|-._:    :          |   \ \
         /  /   :_|   ;`-._;   __..--';    : :
        /  (    ;|;-./_  _/.-:'o |   /     ' |
       /  , \._/_/_./--''/_|:|___|_,'        |
      :  /   `'-'--'----'---------'          |
      | :     O ._O   O_. O ._O   O_.      ; ;
      : `.      //    //    //    //     ,' /
    ~~~`.______//____//____//____//_______,'~
              //    //~   //    //
       ~~   _//   _//   _// ~ _//     ~
     ~     / /   / /   / /   / /  ~      ~~
          ~~~   ~~~   ~~~   ~~~

const depthMapXPos = {};
const depthMapYPos = {};

nodes.forEach(n => {
Copy link
Contributor

Choose a reason for hiding this comment

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

are nodes dom elements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are the nodes returned to us after creating the Sankey graph using d3

https://github.com/d3/d3-sankey#sankey_nodes

Copy link
Contributor

Choose a reason for hiding this comment

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

I just wanted to make sure that this isn't a DOM element array, as they don't have the same prototypical functions as regular arrays

nodes.forEach(n => {
depthMapXPos[n.depth] = n.x0;

if (depthMapYPos[n.depth]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this can be flattened into a ternary

depthMapYPos[n.depth] = n.y0;
}
// For the given depth, set the y equal to the highest positioned y value
depthMapYPos[n.depth]
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry to be picky, but I think it would be more readable to do

depthMapYPos[n.depth] = depthMapYPos[n.depth] ? Math.min(n.y0, depthMapYPos[n.depth] : n.y0;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's true 👍

@krissalvador27 krissalvador27 merged commit b9029d3 into master May 31, 2018
@krissalvador27 krissalvador27 deleted the add-step-labeling-to-sankey branch May 31, 2018 20:51
krissalvador27 pushed a commit that referenced this pull request May 31, 2018
* Histogram improvements + tests (#57)

* Add react-docgen to devDependencies

* Histogram improvements - calculate yDomain and based off given data. Include mouse interaction and styling props. Add tests.

* Test horizontal props for BarChart

* Histogram - move binning into render function to handle dynamic data, make value prop a function, improve docs, remove unused code

* rebuild docs

* Integrate prettier & eslint code styles + add linting as part of npm test (#58)

* Add prettier & eslint code style rules

* Include eslint process with npm test

* Clean up and refactor (#59)

* Add prettier & eslint code style rules

* Remove legacy code and evaluate any todos

* Only send valid XYPlot props to children. Resolves #22

* Check against master list of scaleTypes

* Implement invertX and invertY scale

* Alphabetically sort props displayed on docs

* Update documentation for x and y axis labels and titles

* Clean up code and todos

* includeXZero and includeYZero props + test

* feature(yaml): add ci/cd (#60)

* feature(version): version bump (#61)

* feature(version): version bump

* feature(lockfile): add a lockfile

* Clean up multiple warning logs and fix regression on children components not getting their defaultProps (#64)

* Include css in root and add less -> css to build process (#63)

* Include css in root and add to build process

* Update readme directions to run examples

* add AreaBarChart spec (#65)

* Namespace css classes + update class and style props where applicable (#66)

* AreaChartBar namespace

* AreaChart namespace

* AreaHeatMap namespace + accessor class and style funcs

* BarChart update documentation

* ColorHeatmap namespace and update documentation

* FunnelChart namespace and accessors

* Add lineStyle and lineClassName to KDE and remove unused prop in LineChart

* MarketLineChart namespace and class and style accessors

* RangeBarChart namespace

* ScatterPlot namespace

* PieChart documentation and updates

* XYPlot namespace and underlying components

* Add classes to linechart, remove unused styles

* Namespace SankeyDiagram and updates to PieChart

* Update tests

* Update docs

* Add backwards compatibility for markerLineClass

* Update docs

* Use className from props for RangeRect

* Add disableMouseWheelZoom prop to ZoomContainer  (#67)

* Add disable mousewheel prop to reactochart

* Update docs

* 0.4.6 release (#68)

* Update README.md to include directions for importing styles (#71)

* add ColorHeatmap spec (#72)

* add ColorHeatmap spec

* generate build docs

* Add step labeling to sankey (#73)

* Add step labeling functionality to sankey

* Update tests for sankey to include step labels

* Update docs

* Add step labeling functionality to sankey

* Update tests for sankey to include step labels

* Update docs

* PR review + documentation

* Better ternary

* Update changelog and bump version (#74)
krissalvador27 pushed a commit that referenced this pull request Jun 8, 2018
* Histogram improvements + tests (#57)

* Add react-docgen to devDependencies

* Histogram improvements - calculate yDomain and based off given data. Include mouse interaction and styling props. Add tests.

* Test horizontal props for BarChart

* Histogram - move binning into render function to handle dynamic data, make value prop a function, improve docs, remove unused code

* rebuild docs

* Integrate prettier & eslint code styles + add linting as part of npm test (#58)

* Add prettier & eslint code style rules

* Include eslint process with npm test

* Clean up and refactor (#59)

* Add prettier & eslint code style rules

* Remove legacy code and evaluate any todos

* Only send valid XYPlot props to children. Resolves #22

* Check against master list of scaleTypes

* Implement invertX and invertY scale

* Alphabetically sort props displayed on docs

* Update documentation for x and y axis labels and titles

* Clean up code and todos

* includeXZero and includeYZero props + test

* feature(yaml): add ci/cd (#60)

* feature(version): version bump (#61)

* feature(version): version bump

* feature(lockfile): add a lockfile

* Clean up multiple warning logs and fix regression on children components not getting their defaultProps (#64)

* Include css in root and add less -> css to build process (#63)

* Include css in root and add to build process

* Update readme directions to run examples

* add AreaBarChart spec (#65)

* Namespace css classes + update class and style props where applicable (#66)

* AreaChartBar namespace

* AreaChart namespace

* AreaHeatMap namespace + accessor class and style funcs

* BarChart update documentation

* ColorHeatmap namespace and update documentation

* FunnelChart namespace and accessors

* Add lineStyle and lineClassName to KDE and remove unused prop in LineChart

* MarketLineChart namespace and class and style accessors

* RangeBarChart namespace

* ScatterPlot namespace

* PieChart documentation and updates

* XYPlot namespace and underlying components

* Add classes to linechart, remove unused styles

* Namespace SankeyDiagram and updates to PieChart

* Update tests

* Update docs

* Add backwards compatibility for markerLineClass

* Update docs

* Use className from props for RangeRect

* Add disableMouseWheelZoom prop to ZoomContainer  (#67)

* Add disable mousewheel prop to reactochart

* Update docs

* 0.4.6 release (#68)

* Update README.md to include directions for importing styles (#71)

* add ColorHeatmap spec (#72)

* add ColorHeatmap spec

* generate build docs

* Add step labeling to sankey (#73)

* Add step labeling functionality to sankey

* Update tests for sankey to include step labels

* Update docs

* Add step labeling functionality to sankey

* Update tests for sankey to include step labels

* Update docs

* PR review + documentation

* Better ternary

* Update changelog and bump version (#74)

* add AreaHeatmap, FunnelChart spec (#77)

* add AreaHeatmap spec

* add FunnelChart spec

* feature(Standards): add in code of conduct and NOTICE file (#76)

* Zoom container spec (#78)

* Zoom Container spec
* Added npm run test-files

* Add eslint to tests (#79)

* Add tests to linter

* Update tests with lint-fix

* Fix growl dependency via mocha (#80)

* Fix growl dependency on mocha

* Update package lock json

* Update version and changelog (#81)
install pushed a commit that referenced this pull request Feb 25, 2020
* Add step labeling functionality to sankey

* Update tests for sankey to include step labels

* Update docs

* Add step labeling functionality to sankey

* Update tests for sankey to include step labels

* Update docs

* PR review + documentation

* Better ternary
install pushed a commit that referenced this pull request Feb 25, 2020
* Histogram improvements + tests (#57)

* Add react-docgen to devDependencies

* Histogram improvements - calculate yDomain and based off given data. Include mouse interaction and styling props. Add tests.

* Test horizontal props for BarChart

* Histogram - move binning into render function to handle dynamic data, make value prop a function, improve docs, remove unused code

* rebuild docs

* Integrate prettier & eslint code styles + add linting as part of npm test (#58)

* Add prettier & eslint code style rules

* Include eslint process with npm test

* Clean up and refactor (#59)

* Add prettier & eslint code style rules

* Remove legacy code and evaluate any todos

* Only send valid XYPlot props to children. Resolves #22

* Check against master list of scaleTypes

* Implement invertX and invertY scale

* Alphabetically sort props displayed on docs

* Update documentation for x and y axis labels and titles

* Clean up code and todos

* includeXZero and includeYZero props + test

* feature(yaml): add ci/cd (#60)

* feature(version): version bump (#61)

* feature(version): version bump

* feature(lockfile): add a lockfile

* Clean up multiple warning logs and fix regression on children components not getting their defaultProps (#64)

* Include css in root and add less -> css to build process (#63)

* Include css in root and add to build process

* Update readme directions to run examples

* add AreaBarChart spec (#65)

* Namespace css classes + update class and style props where applicable (#66)

* AreaChartBar namespace

* AreaChart namespace

* AreaHeatMap namespace + accessor class and style funcs

* BarChart update documentation

* ColorHeatmap namespace and update documentation

* FunnelChart namespace and accessors

* Add lineStyle and lineClassName to KDE and remove unused prop in LineChart

* MarketLineChart namespace and class and style accessors

* RangeBarChart namespace

* ScatterPlot namespace

* PieChart documentation and updates

* XYPlot namespace and underlying components

* Add classes to linechart, remove unused styles

* Namespace SankeyDiagram and updates to PieChart

* Update tests

* Update docs

* Add backwards compatibility for markerLineClass

* Update docs

* Use className from props for RangeRect

* Add disableMouseWheelZoom prop to ZoomContainer  (#67)

* Add disable mousewheel prop to reactochart

* Update docs

* 0.4.6 release (#68)

* Update README.md to include directions for importing styles (#71)

* add ColorHeatmap spec (#72)

* add ColorHeatmap spec

* generate build docs

* Add step labeling to sankey (#73)

* Add step labeling functionality to sankey

* Update tests for sankey to include step labels

* Update docs

* Add step labeling functionality to sankey

* Update tests for sankey to include step labels

* Update docs

* PR review + documentation

* Better ternary

* Update changelog and bump version (#74)
install pushed a commit that referenced this pull request Feb 25, 2020
* Histogram improvements + tests (#57)

* Add react-docgen to devDependencies

* Histogram improvements - calculate yDomain and based off given data. Include mouse interaction and styling props. Add tests.

* Test horizontal props for BarChart

* Histogram - move binning into render function to handle dynamic data, make value prop a function, improve docs, remove unused code

* rebuild docs

* Integrate prettier & eslint code styles + add linting as part of npm test (#58)

* Add prettier & eslint code style rules

* Include eslint process with npm test

* Clean up and refactor (#59)

* Add prettier & eslint code style rules

* Remove legacy code and evaluate any todos

* Only send valid XYPlot props to children. Resolves #22

* Check against master list of scaleTypes

* Implement invertX and invertY scale

* Alphabetically sort props displayed on docs

* Update documentation for x and y axis labels and titles

* Clean up code and todos

* includeXZero and includeYZero props + test

* feature(yaml): add ci/cd (#60)

* feature(version): version bump (#61)

* feature(version): version bump

* feature(lockfile): add a lockfile

* Clean up multiple warning logs and fix regression on children components not getting their defaultProps (#64)

* Include css in root and add less -> css to build process (#63)

* Include css in root and add to build process

* Update readme directions to run examples

* add AreaBarChart spec (#65)

* Namespace css classes + update class and style props where applicable (#66)

* AreaChartBar namespace

* AreaChart namespace

* AreaHeatMap namespace + accessor class and style funcs

* BarChart update documentation

* ColorHeatmap namespace and update documentation

* FunnelChart namespace and accessors

* Add lineStyle and lineClassName to KDE and remove unused prop in LineChart

* MarketLineChart namespace and class and style accessors

* RangeBarChart namespace

* ScatterPlot namespace

* PieChart documentation and updates

* XYPlot namespace and underlying components

* Add classes to linechart, remove unused styles

* Namespace SankeyDiagram and updates to PieChart

* Update tests

* Update docs

* Add backwards compatibility for markerLineClass

* Update docs

* Use className from props for RangeRect

* Add disableMouseWheelZoom prop to ZoomContainer  (#67)

* Add disable mousewheel prop to reactochart

* Update docs

* 0.4.6 release (#68)

* Update README.md to include directions for importing styles (#71)

* add ColorHeatmap spec (#72)

* add ColorHeatmap spec

* generate build docs

* Add step labeling to sankey (#73)

* Add step labeling functionality to sankey

* Update tests for sankey to include step labels

* Update docs

* Add step labeling functionality to sankey

* Update tests for sankey to include step labels

* Update docs

* PR review + documentation

* Better ternary

* Update changelog and bump version (#74)

* add AreaHeatmap, FunnelChart spec (#77)

* add AreaHeatmap spec

* add FunnelChart spec

* feature(Standards): add in code of conduct and NOTICE file (#76)

* Zoom container spec (#78)

* Zoom Container spec
* Added npm run test-files

* Add eslint to tests (#79)

* Add tests to linter

* Update tests with lint-fix

* Fix growl dependency via mocha (#80)

* Fix growl dependency on mocha

* Update package lock json

* Update version and changelog (#81)
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.

2 participants