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
UI/bar chart horizontal #12437
UI/bar chart horizontal #12437
Conversation
* | ||
* @example | ||
* ```js | ||
* <BarChartComponent @title="Top 10 Namespaces" @description="Each namespace's client count includes clients in child namespaces." @labelKey="namespace_path" @dataset={{this.testData}} @mapLegend={{ array (hash key="non_entity_tokens" label="Active direct tokens") (hash key="distinct_entities" label="Unique Entities") }} @onClick={{this.onClick}} > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All on one line because storybook didn't like when each arg was on its own line...
} | ||
} | ||
|
||
.header-right { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.header-right
is where anything passed into the block is yielded (i.e. an export button). Should this styling be less specific since the button is no longer part of this component?
import { select, event, selectAll } from 'd3-selection'; | ||
// eslint-disable-next-line no-unused-vars | ||
import { transition } from 'd3-transition'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chart styling is within the component file for now so that a future developer doesn't have to hunt down the .css
file and some .css
styling is kind of wonky when interacting with d3. In next PR, when cleaning up d3, may consider moving all static styling to .css
.append('rect') | ||
.attr('class', 'data-bar') | ||
.style('cursor', 'pointer') | ||
.attr('width', chartData => `${xScale(chartData[1] - chartData[0] - 5)}%`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 5
is responsible for the small gap between horizontal bars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start. I know you still have some refinements that can come in future PRs. This component works, and getting it merged will make it easier for the development process on the metrics project.
* creates bar chart component * WIP//starts styling * fixes width of bars * WIP//barchart * uses d3 max method instead of Math.max * stacks data * adds y axis * fixes styling and spacing * adds spacing between bars * styling DONE * adds legend * adds tooltip * tweaks styling adds pointer cursor to rects * fixes tooltip placement * moves starget from bar to whole area * finishes hover selection styling * cleans up * cleans up a tiny bit * stopping point * adjusts tooltip placemnt * WIP//clean up time * sort of not broken * unbroken, ish * tooltip position fixed * truncates text and adds tooltip * changes tooltip width depending on content * unbroken * finishes initial refactor/cleanup * finishes documentation * passes in map legend to component * more tidying * add export option * adds grid to header for export button option * updates comments * fix variable name change * moves dataset formatting to parent * removes unused code" * adds assertions and empty state if no data * cleans up comments adds assertion to check for map legend * adds storybook * adds changelog * deletes dummy parent: * restores index.hbs * uses scss variables instead * exchanges more variables * remove unused variable in storybook * writes basic test * removes pauseTest()
Horizontal bar chart component for client counts.
TO DO: