This repository was archived by the owner on Jul 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
More examples #133
Open
rbaheti
wants to merge
8
commits into
main
Choose a base branch
from
more-examples
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
More examples #133
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3a69e69
adds box and whisker mode example
rbaheti c2d73ce
adds lineplot grouping example
rbaheti 62136af
adds scatter plot example
rbaheti d34e150
adds hide tooltip example
rbaheti 5eea462
addresses all hiding tooltip comments in the PR
rbaheti 1bf0b37
modifies disabling tooltip description as suggested in PR
rbaheti cbe6b1e
Addresses PR comments for line plot and scatter plot groupings
rbaheti 42ca171
addresses all PR comments for box-whisker-mode
rbaheti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,46 @@ | ||
| # Using a Different Box and Whisker Mode | ||
|
|
||
| The "mode" of a Box and Whisker plot changes the placement of the extent of the whiskers. The [`BoxWhisker`](http://d3plus.org/docs/#BoxWhisker) class defaults to using the "[tukey](https://en.wikipedia.org/wiki/Box_plot#Variations)" method, but this can be changed by setting the `whiskerMode` property of the [`Box`](http://d3plus.org/docs/#Box) shape class using [shapeConfig](http://d3plus.org/docs/#Viz.shapeConfig). Accepted values are `"tukey"`, `"extent"`, or an Array of 2 numbers used as the bottom and top percentile. | ||
|
|
||
| ```js | ||
| var myData = [ | ||
| {id: "alpha", value: 840}, | ||
| {id: "alpha", value: 940}, | ||
| {id: "alpha", value: 780}, | ||
| {id: "alpha", value: 650}, | ||
| {id: "alpha", value: 720}, | ||
| {id: "alpha", value: 430}, | ||
| {id: "alpha", value: 1850}, | ||
| {id: "alpha", value: 300}, | ||
| {id: "alpha", value: 360}, | ||
| {id: "alpha", value: 1690}, | ||
| {id: "alpha", value: 690}, | ||
| {id: "alpha", value: -950}, | ||
| {id: "alpha", value: -600}, | ||
| {id: "alpha", value: -850}, | ||
| {id: "beta", value: 980}, | ||
| {id: "beta", value: 300}, | ||
| {id: "beta", value: 120}, | ||
| {id: "beta", value: 500}, | ||
| {id: "beta", value: 140}, | ||
| {id: "beta", value: 115}, | ||
| {id: "beta", value: 14}, | ||
| {id: "beta", value: -30}, | ||
| {id: "beta", value: -1050}, | ||
| {id: "beta", value: -100}, | ||
| {id: "beta", value: -800}, | ||
| {id: "beta", value: -1100}, | ||
| ]; | ||
|
|
||
| new d3plus.BoxWhisker() | ||
| .config({ | ||
| data: myData, | ||
| groupBy: ["id", "value"], | ||
| shapeConfig: { | ||
| whiskerMode: "extent" | ||
| }, | ||
| x: "id", | ||
| y: "value" | ||
| }) | ||
| .render(); | ||
| ``` | ||
This file contains hidden or 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,24 @@ | ||
| # Disabling Tooltips | ||
|
|
||
| To hide the default tooltips in any D3plus chart, set the [tooltip](http://d3plus.org/docs/#Viz.tooltip) property to `false`. | ||
|
|
||
| ```js | ||
| var myData = [ | ||
| {id: "alpha", xAxis: 4, yAxis: 7}, | ||
| {id: "alpha", xAxis: 5, yAxis: 25}, | ||
| {id: "alpha", xAxis: 6, yAxis: 13}, | ||
| {id: "beta", xAxis: 4, yAxis: 17}, | ||
| {id: "beta", xAxis: 5, yAxis: 8}, | ||
| {id: "beta", xAxis: 6, yAxis: 13} | ||
| ]; | ||
|
|
||
| new d3plus.BarChart() | ||
| .config({ | ||
| data: myData, | ||
| groupBy: "id", | ||
| tooltip: false, | ||
| x: "xAxis", | ||
| y: "yAxis" | ||
| }) | ||
| .render(); | ||
| ``` |
This file contains hidden or 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,34 @@ | ||
| # Line Plot Grouping | ||
|
|
||
| You can group the lines in a [LinePlot](http://d3plus.org/docs/#LinePlot) by passing the [`groupBy`](https://d3plus.org/docs/#Viz.groupBy) property a nested Array of keys instead of a single key. This enables automatic line groupings/nestings and click behavior to dive into groups. The default level shown is defined using the [`depth`](https://d3plus.org/docs/#Viz.depth) method. | ||
|
|
||
| ```js | ||
| var myData = [ | ||
| {"year": 1991, "name":"alpha", "value": 15, "parent": "parent 1"}, | ||
| {"year": 1992, "name":"alpha", "value": 20, "parent": "parent 1"}, | ||
| {"year": 1993, "name":"alpha", "value": 30, "parent": "parent 1"}, | ||
| {"year": 1994, "name":"alpha", "value": 60, "parent": "parent 1"}, | ||
| {"year": 1991, "name":"beta", "value": 10, "parent": "parent 1"}, | ||
| {"year": 1992, "name":"beta", "value": 10, "parent": "parent 1"}, | ||
| {"year": 1993, "name":"beta", "value": 40, "parent": "parent 1"}, | ||
| {"year": 1994, "name":"beta", "value": 60, "parent": "parent 1"}, | ||
| {"year": 1991, "name":"gamma", "value": 5, "parent": "parent 2"}, | ||
| {"year": 1992, "name":"gamma", "value": 10, "parent": "parent 2"}, | ||
| {"year": 1993, "name":"gamma", "value": 20, "parent": "parent 2"}, | ||
| {"year": 1994, "name":"gamma", "value": 25, "parent": "parent 2"}, | ||
| {"year": 1991, "name":"delta", "value": 50, "parent": "parent 2"}, | ||
| {"year": 1992, "name":"delta", "value": 43, "parent": "parent 2"}, | ||
| {"year": 1993, "name":"delta", "value": 17, "parent": "parent 2"}, | ||
| {"year": 1994, "name":"delta", "value": 32, "parent": "parent 2"} | ||
| ] | ||
|
|
||
| new d3plus.LinePlot() | ||
| .config({ | ||
| data: myData, | ||
| depth: 0, | ||
| groupBy: ["parent", "name"], | ||
| x: "year", | ||
| y: "value" | ||
| }) | ||
| .render(); | ||
| ``` |
This file contains hidden or 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,27 @@ | ||
| # Scatter Plot Grouping | ||
|
|
||
| You can group the bubbles in a Scatter Plot by passing the [`groupBy`](https://d3plus.org/docs/#Viz.groupBy) property a nested Array of keys instead of a single key. This enables automatic shape groupings/nestings and click behavior to dive into groups. The default level shown is defined using the [`depth`](https://d3plus.org/docs/#Viz.depth) method. | ||
|
|
||
| ```js | ||
| var myData = [ | ||
| {"value": 100, "weight": .45, "name": "alpha", "group": "group 1"}, | ||
| {"value": 70, "weight": .60, "name": "beta", "group": "group 2"}, | ||
| {"value": 40, "weight": -.2, "name": "gamma", "group": "group 2"}, | ||
| {"value": 15, "weight": .1, "name": "delta", "group": "group 2"}, | ||
| {"value": 5, "weight": -.43, "name": "epsilon", "group": "group 1"}, | ||
| {"value": 1, "weight": 0, "name": "zeta", "group": "group 1"} | ||
| ] | ||
|
|
||
| new d3plus.Plot() | ||
| .config({ | ||
| data: myData, | ||
| depth: 0, | ||
| groupBy: ["group", "name"], | ||
davelandry marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| size: "value", | ||
| sizeMax: 100, | ||
| sizeMin: 20, | ||
| x: "value", | ||
| y: "weight" | ||
| }) | ||
| .render(); | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.