Skip to content

Scatterplot + Legend Symbols on IE

Pre-release
Pre-release
Compare
Choose a tag to compare
@jtlan jtlan released this 03 Apr 21:57
· 4446 commits to master since this release

v0.51.0

Good afternoon,

Since non-scaling-stroke does not work on Internet Explorer, we had to change our approach to drawing symbols. A SymbolFactory now draws a particular symbol given a size; see below for what changes this causes to the API.

Bugfixes

API-Breaking Changes

  • The SymbolGenerators module has been renamed to SymbolFactories
  • A SymbolFactory is now a function with the following signature:
(symbolSize: number) => string

where symbolSize is the edge-length of a square drawn as a tight bound around the symbol.

  • Legends symbolGenerator API has been reworked into symbolFactoryAccessor which takes in an accessor function that returns a SymbolFactory. It has the following signature:
public symbolFactoryAccessor((datum: any, index: number) => SymbolFactory)

This allows selection of the SymbolFactory to use based on the Legend entry.

Upgrade Instructions

  • Instead of using the d3Symbol SymbolFactory, one of the following endpoints should be used instead:
Plottable.SymbolFactories.square();
Plottable.SymbolFactories.circle();
Plottable.SymbolFactories.diamond();
Plottable.SymbolFactories.cross();
Plottable.SymbolFactories.triangleUp();
Plottable.SymbolFactories.triangleDown();
  • project() calls for symbols have to be adjusted:
var squareGenerator = Plottable.SymbolFactories.square();
scatterplot.project("symbol", function(d, i) { return squareGenerator; });
  • To set the size of points on Plot.Scatter, project() on "size" instead of "r":
// before: project("r", 3);
scatterplot.project("size", 6); // size of square containing symbol, instead of radius of symbol

Release Song

Gold Rays -- Vinyl Pinups
https://www.youtube.com/watch?v=Izl8zFCWSjA