Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
d3-scale-interactive
Advanced tools
Demo: http://peterbeshai.com/vis/d3-scale-interactive/
Modify your d3-scales interactively in your browser with this plugin. You can change nearly all aspects of the scale via the user interface and see your charts update dynamically.
What if you could interactively play with your scales in any vis, just by replacing your initialization of the scales
const colorScale = d3.scaleSequential(...);
with
const colorScale = d3.scaleInteractive('color', updateChart).scaleSequential(...);
This way it's easy to develop with/turn on and off. Here updateChart
is the function called to re-draw a chart with updated properties or data.
Original
color = d3
.scaleSequential(d3.interpolateMagma)
.domain(d3.extent(data, d => d.v));
With interactivity
color = d3.scaleInteractive('color', updateChart)
.scaleSequential(d3.interpolateMagma)
.domain(d3.extent(data, d => d.v));
Each scale gets its own panel in the user interface that can be collapsed or expanded by clicking the header. Beneath the header are five commands: Pin, Code, Debug, Stats, and Reset.
If your update callback recreates your scale or modifies some properties of the scale, you may want to pin the scale in the UI. This prevents all changes made outside the UI from affecting the scale. This control is a toggle.
Outputs the javascript code needed to recreate the scale to the browser's console.
Adds the scale to the global _scales
object allowing you to access your scale in the console. Each scale will have three entries in _scales
. If your scale name was color
, you'd see:
_scales.color
- The scale object used by scaleInteractive. Updating values to this will be reflected automatically in the UI and in the stats collection._scales.colorRaw
- The d3 scale that is wrapped by scaleInteractive._scales.colorScaleProxy
- The ScaleProxy object used by scaleInteractive.Displays histograms or bar charts of the domain and range values used by the scale. This control is a toggle.
Resets the changes made through the scaleInteractive user interface.
Get rollup watching for changes and rebuilding
npm run watch
Run a web server in the example directory
cd example
php -S localhost:8000
Go to http://localhost:8000
If you use NPM, npm install d3-scale-interactive
. Otherwise, download the latest release.
# scaleInteractive(name, updateFunction)
Creates an interactive UI in the browser to modify scale parameters within. You must provide a unique name for the scale, as well as updateFunction - the function used to redraw your visualization when data or other properties change.
Example usage:
var x = d3.scaleInteractive('x', updateChart).scaleLinear().domain([0, 10]).range([15, 100]);
...
function updateChart(newData) {
d3.selectAll('rect').data(newData)
.attr('x', function (d) { return x(d.x); });
...
}
# scaleInteractive.options(options)
Updates the global scale interactive options with an options object. Currently there is only one option:
false
): initializes the main UI to begin collapsedThese options must be set before any other call to scaleInteractive as they are not read past initialization.
Example usage:
d3.scaleInteractive.options({ startHidden: true });
FAQs
An interactive UI for editing d3 v4 scales in your browser
The npm package d3-scale-interactive receives a total of 11 weekly downloads. As such, d3-scale-interactive popularity was classified as not popular.
We found that d3-scale-interactive demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.