Releases: palantir/plottable
1.0.0 Release Candidate 7
Overview
Why 1.0.0?
There are a number of known issues in the Plottable API that require breaking backwards compatibility to fix. That means there are a number of backwards-incompatible changes in this release. We are working hard to remedy these problems, and get the API in a state that will allow us to maintain backwards compatibility for all releases after v1.0.0.
To provide the best experience to our users, we are rolling out incremental release candidate releases to allow for pre-integration testing. These release candidates are not meant for production, but are meant as testing resources.
Theme of the 1.0.0-rc series
Because of the breaking changes between v0.54.0 and v1.0.0, our goal is that these release candidates will help make the upgrade as smooth as possible for you all, by allowing you to test early, and often.
Please test with these release candidates and make sure you're able to migrate to the new feature set without losing functionality. If you encounter any issues, please file issues here.
A description of the major changes is below. Full instructions on migrating from v0.54.0 to v1.0.0 will be kept updated in our Upgrading to 1.0.0 Guide.
UMD
If a module loader is used to load Plottable, it will no longer export a global variable Plottable
. Previously Plottable
would be attached to the window
whether or not a module loader was used, which was a bug.
API Changes between 1.0.0-rc6 and 1.0.0-rc7
Type renames
Animators.Plot
(interface) ->Animator
(interface)
Axes
-
Axis.gutter()
->Axis.margin()
-
The
constructor
no longer takes in aFormatter
:constructor(scale: Scale<D, number>, orientation: string);
To specify the
Formatter
, use theformatter()
method after construction.
Component
-
protected _getSize()
-->protected _sizeFromOffer()
-
classed()
has been split into three methods:/** * Checks if the Component has a given CSS class. * * @param {string} cssClass The CSS class to check for. */ hasClass(cssClass: string): boolean; /** * Adds a given CSS class to the Component. * * @param {string} cssClass The CSS class to add. * @returns {Component} The calling Component. */ addClass(cssClass: string): Component; /** * Removes a given CSS class from the Component. * * @param {string} cssClass The CSS class to remove. * @returns {Component} The calling Component. */ removeClass(cssClass: string): Component;
While this is a departure from the D3 signature, separate methods should cut down on confusion and mistakes, particularly the case where a user attempts to set a class using
classed(classname)
without theboolean
.
Legend
symbolFactoryAccessor()
-->symbol()
Utils.DOM
getBBox()
->elementBBox()
getElementWidth()
->elementWidth()
getElementHeight()
->elementHeight()
getBoundingSVG()
->boundingSVG()
getUniqueClipPathId()
->generateUniqueClipPathId()
getSVGPixelWidth()
-> REMOVEDgetParsedStyleValue()
-> REMOVEDisSelectionRemovedFromSVG()
-> REMOVED
If you were using the removed methods, please contact us.
Utils.Formatter
timeIntervalToD3Time
moved toScales.Time
.
Utils.Stacking
Utils.Stacked
has been renamed to Utils.Stacking
.
-
StackedDatum
type no longer includes the key. -
The new type
StackingResult
:export type StackingResult = Utils.Map<Dataset, Utils.Map<string, StackedDatum>>;
-
computeStackOffsets()
->stack()
The signature has also changed to:stack(datasets: Dataset[], keyAccessor: Accessor<any>, valueAccessor: Accessor<number>): StackingResult
-
computeStackExtent()
->stackedExtent()
. The signature has also changed to:stackedExtent(stackingResult: StackingResult, keyAccessor: Accessor<any>, filter: Accessor<boolean>)
-
domainKeys()
-> DELETED (privatized)
Utils.Window
copyObject()
removed.
Animators.Easing
Animators.Base
has been renamed toAnimators.Easing
.iterativeDelay()
->stepDelay()
easing()
->easingMode()
static
fieldsDEFAULT_START_DELAY_MILLISECONDS
,DEFAULT_STEP_DURATION_MILLISECONDS
,DEFAULT_ITERATIVE_DELAY_MILLISECONDS
,DEFAULT_MAX_TOTAL_DURATION_MILLISECONDS
, andDEFAULT_EASING
have been removed. The default values can be queried by creating a newAnimators.Easing
and calling the appropriate getters.
Drawer
s
Drawers.Element
's logic has been moved up to the baseDrawer
class.Drawers.Area
no longer extendsDrawers.Line
.
Interactions.Drag
constrainToComponent()
-->constrainedToComponent()
Plot
getAllSelections()
-->selections()
XYPlot
autorange()
-->autorangeMode()
to more accurately reflect the functionality of this API point.
Plots.Bar
labelsFormatter()
-->labelFormatter()
(revert to previous name)
Scales.InterpolatedColor
-
colorRange()
->range()
-
The
constructor
no longer takes in the color range, bringing it more in line with the constructor onScales.Color
:constructor(scaleType?: string);
To set the color range, call
range()
after construction.
RenderController
setRenderPolicy()
-->renderPolicy()
, and now also functions as a getter.
1.0.0 Release Candidate 6
Overview
Why 1.0.0?
There are a number of known issues in the Plottable API that require breaking backwards compatibility to fix. That means there are a number of backwards-incompatible changes in this release. We are working hard to remedy these problems, and get the API in a state that will allow us to maintain backwards compatibility for all releases after v1.0.0.
To provide the best experience to our users, we are rolling out incremental release candidate releases to allow for pre-integration testing. These release candidates are not meant for production, but are meant as testing resources.
Theme of the 1.0.0-rc series
Because of the breaking changes between v0.54.0 and v1.0.0, our goal is that these release candidates will help make the upgrade as smooth as possible for you all, by allowing you to test early, and often.
Please test with these release candidates and make sure you're able to migrate to the new feature set without losing functionality. If you encounter any issues, please file issues here.
A description of the major changes is below. Full instructions on migrating from v0.54.0 to v1.0.0 will be kept updated in our Upgrading to 1.0.0 Guide.
d3.d.ts update
DefinitelyTyped has accepted our corrections to the d3.d.ts file, so tsd
can again be used to update definitions. It is no longer necessary to use the copy of d3.d.ts from the Plottable repository.
API Changes between 1.0.0-rc5 and 1.0.0-rc6
Generalized Entity
Entity
is now generic on the Component
type:
export interface Entity<C extends Component> {
datum: any;
position: Point;
selection: d3.Selection<any>;
component: C;
}
And Plots.PlotEntity
extends Entity
:
interface PlotEntity extends Entity<Plot> {
dataset: Dataset;
index: number;
component: Plot;
}
Changes:
dataset
moved toPlotEntity
, since currently onlyPlot
s haveDataset
s.index
was intended to work withdataset
, and so has also been moved toPlotEntity
.
Plot
calls that previously returned Entity
or Entity[]
now return PlotEntity
and PlotEntity[]
.
Legend
scale()
-->colorScale()
entitiesAt()
replacesgetEntry()
and returnsEntity<Legend>[]
.
Scales.ModifiedLog
- The
showIntermediateTicks()
endpoint has been removed. To exercise more control over which ticks are displayed, assign a customTickGenerator
to theScale
.
Animators.Rect
/ Animators.MovingRect
Animators.Rect
andAnimators.MovingRect
have been removed. Their logic was very specific towards the use case inPlots.Bar
, which now uses a properly configuredAnimators.Base
instead. If you are interested in the animation logic used in those animators, please contact us.
SymbolFactories
- The type
StringAccessor
has been removed, as there are no Plottable API points that use it.
Component
- The
_element
instance variable has been madeprivate
(previouslyprotected
). Operating directly on thisSelection
is an error -- useforeground()
,content()
, orbackground()
instead, as appropriate. - The
_content
instance variable has been madeprivate
(previouslyprotected
). The content-Selection
can still be accessed withcontent()
.
Plot
- The
_datasetToDrawer
instance variable has been madeprivate
(previouslyprotected
). - The
_attrBindings
instance variable has been madeprivate
(previouslyprotected
). Useattr()
to retrive theAccessorScaleBinding
instead. - The
_attrExtents
instance variable has been madeprivate
(previouslyprotected
).
Plots.Bar
- The
protected static
_DEFAULT_WIDTH
variable has been removed, since it no longer served a purpose insidePlots.Bar
or its subclasses. labelFormatter()
-->labelsFormatter()
Plots.StackedArea
- The
protected
method_wholeDatumAttributes()
has been removed. Previously this was the list of attributes:
["x", "y", "defined", "d"]
Animators.Base
A number of renames for clarity:
delay()
->startDelay()
duration()
->stepDuration()
maxIterativeDelay
->iterativeDelay()
maxTotalDuration()
now defaults toInfinity
. The maximum total duration of animations onPlot
s remains at the old default of 600ms.DEFAULT_DELAY_MILLISECONDS
->DEFAULT_START_DELAY_MILLISECONDS
DEFAULT_DURATION_MILLISECONDS
->DEFAULT_STEP_DURATION_MILLISECONDS
DEFAULT_MAX_ITERATIVE_DELAY_MILLISECONDS
->DEFAULT_ITERATIVE_DELAY_MILLISECONDS
Drawer
s
- added
totalTime()
, which returns the total time that would be spent drawing (in milliseconds). draw()
now returns the callingDrawer
, instead of the total time that would be spent drawing.
UMD
Plottable now uses the Universal Module Definition API, so it should work with AMD and CommonJS.
1.0.0 Release Candidate 5
Overview
Why 1.0.0?
There are a number of known issues in the Plottable API that require breaking backwards compatibility to fix. That means there are a number of backwards-incompatible changes in this release. We are working hard to remedy these problems, and get the API in a state that will allow us to maintain backwards compatibility for all releases after v1.0.0.
To provide the best experience to our users, we are rolling out incremental release candidate releases to allow for pre-integration testing. These release candidates are not meant for production, but are meant as testing resources.
Theme of the 1.0.0-rc series
Because of the breaking changes between v0.54.0 and v1.0.0, our goal is that these release candidates will help make the upgrade as smooth as possible for you all, by allowing you to test early, and often.
Please test with these release candidates and make sure you're able to migrate to the new feature set without losing functionality. If you encounter any issues, please file issues here.
A description of the major changes is below. Full instructions on migrating from v0.54.0 to v1.0.0 will be kept updated in our Upgrading to 1.0.0 Guide.
API Changes between 1.0.0-rc4 and 1.0.0-rc5
baselineValue()
on Plots.Bar()
baselineValue()
now operates on X|Y
, instead of number
:
/**
* Gets the baseline value.
* The baseline is the line that the bars are drawn from.
*
* @returns {X|Y}
*/
baselineValue(): X | Y;
/**
* Sets the baseline value.
* The baseline is the line that the bars are drawn from.
*
* @param {X|Y} value
* @returns {Bar} The calling Bar Plot.
*/
baselineValue(value: X | Y): Bar<X, Y>;
Whether X
or Y
is appropriate depends on the orientation of the Plots.Bar
.
PaddingExceptionsProvider
Now takes a QuantitativeScale
, instead of an ordinary Scale
:
export interface PaddingExceptionsProvider<D> {
(scale: QuantitativeScale<D>): D[];
}
Method renames
Plot
animate()
--> animated()
animated()
now also functions as a getter when invoked with no arguments.
QuantitativeScale
getDefaultTicks()
--> defaultTicks()
Animator
getTiming()
--> totalTime()
Dispatchers.Mouse
getLastMousePosition()
--> lastMousePosition()
Drawer
_getRenderArea()
-->renderArea()
setup(Selection)
->renderArea(Selection)
_getSelector()
-->selector()
_getSelection()
-->selectionForIndex()
Plottable.Utils
refactor
Split utils.ts
(Plottable.Utils.Methods
) into multiple modules (and adequate files). As a result, the module hierarchy (and sometimes the name of the method itself) has changed:
Utils.Methods.inRange() -> Utils.Math.inRange();
Utils.Methods.clamp() -> Utils.Math.clamp();
Utils.Methods.max() -> Utils.Math.max();
Utils.Methods.min() -> Utils.Math.min();
Utils.Methods.isNaN() -> Utils.Math.isNaN();
Utils.Methods.isValidNumber() -> Utils.Math.isValidNumber();
Utils.Methods.range() -> Utils.Math.range();
Utils.Methods.distanceSquared() -> Utils.Math.distanceSquared();
Utils.Methods.addArrays() -> Utils.Array.add();
Utils.Methods.uniq() -> Utils.Array.uniq();
Utils.Methods.createFilledArray() -> Utils.Array.createFilledArray();
Utils.Methods.flatten() -> Utils.Array.flatten();
Utils.Methods.arrayEq() -> DELETED
Utils.Methods.copyMap() -> Utils.Window.copyObject();
Utils.Methods.populateMap() -> DELETED
Utils.Methods.warn() -> Utils.Window.warn();
Utils.Methods.setTimeout() -> Utils.Window.setTimeout();
Utils.Methods.objEq() -> DELETED
Utils.Methods.isIE() -> DELETED
Utils.Methods.parseRange() -> DELETED
Utils.Methods.colorTest() -> Utils.Color.colorTest();
Utils.Methods.lightenColor() -> Utils.Color.lightenColor();
Utils.Methods.intersectsBBox() -> Utils.DOM.intersectsBBox();
Bugfixes
Plot.Area
now cleans up correctly whenDataset
s are removed.QuantitativeScale
now ignoresstring
s and other invalid values when computing the extents, rather than choking on them.
1.0.0 Release Candidate 4
Overview
Why 1.0.0?
There are a number of known issues in the Plottable API that require breaking backwards compatibility to fix. That means there are a number of backwards-incompatible changes in this release. We are working hard to remedy these problems, and get the API in a state that will allow us to maintain backwards compatibility for all releases after v1.0.0.
To provide the best experience to our users, we are rolling out incremental release candidate releases to allow for pre-integration testing. These release candidates are not meant for production, but are meant as testing resources.
Theme of the 1.0.0-rc series
Because of the breaking changes between v0.54.0 and v1.0.0, our goal is that these release candidates will help make the upgrade as smooth as possible for you all, by allowing you to test early, and often.
Please test with these release candidates and make sure you're able to migrate to the new feature set without losing functionality. If you encounter any issues, please file issues here.
A description of the major changes is below. Full instructions on migrating from v0.54.0 to v1.0.0 will be kept updated in our Upgrading to 1.0.0 Guide.
D3 definitions file update
This release candidate uses a new version of d3.d.ts.
This latest version is vastly different from the one that came before. The author of that change describes the changes in detail here.
- When upgrading, use the version in the Plottable repository, because it contains fixes for the latest version of the D3 definitions file.
- For those interested, the fixes are in the process of making it to DefinitelyTyped. Follow the pull request here.
API Changes between 1.0.0-rc3 and 1.0.0-rc4
Axes.Category
- The
orientation
parameter in the constructor is now required:
constructor(scale: Scales.Category, orientation: string, formatter?: (d: any) => string);
Drawer
Plottable.Drawers.AbstractDrawer
has been renamed toPlottable.Drawer
- The
setClass()
endpoint has been removed.
Drawers.Element
- The
svgElement()
endpoint has been removed.
Drawers.Rectangle
Drawers.Rect
has been renamed toDrawers.Rectangle
.
Plots.Bar
- The
barAlignment()
endpoint has been removed. The original goal for that API point was to allow for histogram-like visualizations. We will be implementing aHistogram
class post 1.0.0. orientation()
can be used to get the current orientation of thePlots.Bar
("vertical"
or"horizontal"
).baseline()
has been renamed tobaselineValue()
, which more accurately reflects what the method does.
Scale
addExtentsProvider()
and removeExtentsProvider()
have been replaced by the following methods:
addIncludedValuesProvider(provider: Scales.IncludedValuesProvider<D>): Scale<D, R>;
removeIncludedValuesProvider(provider: Scales.IncludedValuesProvider<D>): Scale<D, R>;
These methods take an IncludedValuesProvider
, which replaces ExtentsProvider
:
interface IncludedValuesProvider<D> {
(scale: Scale<D, any>): D[];
}
An IncludedValuesProvider
is a function that returns an array of domain values. Those values will be included in the domain of the Scale
when it autoDomain()
s.
QuantitativeScale
addIncludedValue()
andremoveIncludedValue()
have been replaced byaddIncludedValuesProvider()
andremoveIncludedValuesProvider()
, listed above.- A similar structure has been adopted for padding exceptions:
addPaddingExceptionsProvider(provider: Scales.PaddingExceptionsProvider<D>): QuantitativeScale<D>;
removePaddingExceptionsProvider(provider: Scales.PaddingExceptionsProvider<D>): QuantitativeScale<D>;
These methods take a PaddingExceptionsProvider
:
interface PaddingExceptionsProvider<D> {
(scale: Scale<D, any>): D[];
}
A PaddingExceptionsProvider
is a function that returns an array of domain values. If any of those values are either end of the domain computed when autoDomain()
-ing, that end of the domain will not be padded.
XYPlot
autorange()
now functions as a getter, returning the current autorange mode ("x"
/"y"
/"none"
).
Type renames
_Projector
->Projector
_Projection
removed, since is has been superseded byPlots.AccessorScaleBinding<any, any>
1.0.0 Release Candidate 3
Overview
Why 1.0.0?
There are a number of known issues in the Plottable API that require breaking backwards compatibility to fix. That means there are a number of backwards-incompatible changes in this release. We are working hard to remedy these problems, and get the API in a state that will allow us to maintain backwards compatibility for all releases after v1.0.0.
To provide the best experience to our users, we are rolling out incremental release candidate releases to allow for pre-integration testing. These release candidates are not meant for production, but are meant as testing resources.
Theme of the 1.0.0-rc series
Because of the breaking changes between v0.54.0 and v1.0.0, our goal is that these release candidates will help make the upgrade as smooth as possible for you all, by allowing you to test early, and often.
Please test with these release candidates and make sure you're able to migrate to the new feature set without losing functionality. If you encounter any issues, please file issues here.
A description of the major changes is below. Full instructions on migrating from v0.54.0 to v1.0.0 will be kept updated in our Upgrading to 1.0.0 Guide
API Changes between 1.0.0-rc2 and 1.0.0-rc3
The changes below outline updates to the API that were not included in the 1.0.0-rc2 release.
public _methodNameHere
methods
The following methods are no longer public
:
getAnimator()
onStackedAreaPlot
is nowprotected
(inline with all the classes in the inheritance tree)_timeoutMsec
onRendererPolicies.Timeout
is nowprivate
_autoDomainIfAutomaticMode()
on theQuantitativeScale
is nowprotected
Label
constructor takes angle
The Label
angle can now be set in the constructor:
var label = new Plottable.Components.Label("My Label", 0);
Valid angles are -90, 0 (horizontal), and 90.
Plots.Rectangle
Plots.Grid
has been removed. Its functionality has been folded intoPlots.Rectangle
Plots.Rectangle
has four property setters:.x()
,.x2()
,.y()
,.y2()
. Thex()
/x2()
properties use the sameScale
, as do they()
/y2()
properties.
Utils.Stacked
The class has been simplified:
- Renamed
Plottable.StackedPlotUtils
->Plottable.Utils.Stacked
- Documentation added
keyAccessor()
method removed as it was implementingPlot
logicvalueAccessor()
method removed as it was implementingPlot
logiccheckSameDomainForStacks()
moved toPlots.StackedArea
as it was only used theredomainKeys()
nowpublic
Axes.Numeric
showEndTickLabel()
has been removed. The function in its current state did not do anything and it did not seem to be tested at all, meaning that it looks like dead functionality.
Drawer
- Constructor takes in a
Dataset
instead of astring
key _getPixelPoint()
has been removed.
Drawers.Rect
drawText()
has been removedremoveLabels()
has been removed_getIfLabelsTooWide()
has been removed
Cleaning up CSS files
Some unused CSS classes have been removed from plottable.css. Changes can be seen here.
Retrieve internal Drag
Interaction
from DragBoxLayer
dragInteraction()
can be used to retrieve the internalDrag
Interaction
fromDragBoxLayer
. One possible use of this feature is to disable drag functionality temporarily:
dragBoxLayer.dragInteraction().detachFrom(dragBoxLayer); // disable
dragBoxLayer.dragInteraction().attachTo(dragBoxLayer); // enable
Plot
s
getAllSelections()
no longer takes in a booleanexclude
parameter as an the second parameter.
To getSelection
s for a certain subset ofDataset
s:
var datasetsToExclude = [...];
var datasetExclusionFilter = function(dataset) { return datasetsToExclude.indexOf(dataset) === -1; }
var unexcludedDatasets = plot.datasets().filter(datasetExclusionFilter);
plot.getAllSelections(unexcludedDatasets);
Plot
s no longer take Scale
s in the constructor
The X and Y Scale
s were already being passed in through .x()
, .y()
, so their inclusion in the constructor was redundant.
Previously:
var plot = new Plottable.Plots.Bar(xScale, yScale);
Now:
var plot = new Plottable.Plots.Bar();
The new constructor
signatures are:
new Plottable.Plot()
new Plottable.XYPlot<type, type>()
new Plottable.Plots.Pie()
<- unchangednew Plottable.Plots.Bar<type, type>(orientation?)
new Plottable.Plots.StackedBar<type, type>(orientation?)
new Plottable.Plots.ClusteredBar<type, type>(orientation?)
new Plottable.Plots.Line<type>()
new Plottable.Plots.Area<type>()
new Plottable.Plots.StackedArea<type>()
new Plottable.Plots.Rectangle<type, type>()
new Plottable.Plots.Scatter<type, type>()
Upgrade Regex
- FIND:
(\.Plots\.[^\(]*\()[^,\)]*(, )?[^\),]*(, )*
- REPLACE:
$1
In addition to this, the following method signatures have been changed to not require a Scale
anymore. The Scale
was redundant because it was already specified on the respective .x()
, .y()
Plots.Area.y0(y0?: number | Accessor<number>): any
Plots.Rectangle.x2(x2?: number | Accessor<number> | X | Accessor<X>): any
Plots.Rectangle.y2(y2?: number | Accessor<number> | Y | Accessor<Y>): any
PlotData
--> Entity
The PlotData
type has been removed. Methods that previously returned PlotData
now use the Entity
type:
export type Entity = {
datum: any;
index: number;
dataset: Dataset;
position: Point;
selection: D3.Selection;
plot: Plot;
}
The names of corresponding methods have been changed:
getAllPlotData()
-->entities()
:
public entities(datasets = this.datasets()): Plots.Entity[];
getClosestPlotData()
-->entityNearest()
:
public entityNearest(queryPoint: Point): Plots.Entity;
On Plots.Bar
, getBars()
has been split into:
public entitiesAt(p: Point): Entity[];
and
public entitiesIn(bounds: Bounds): Entity[];
public entitiesIn(xRange: Range, yRange: Range): Entity[];
Key differences:
Entity
corresponds to exactly one datum and its visual representation on the screen.- The
Dataset
containingdatum
, as well asdatum
's index in thatDataset
, have been included. - The originating
Plot
for theEntity
is also included, which may be helpful if theEntity
is saved off somewhere after it has been created.
RenderPolicy
.setRenderPolicy()
no longer takes aRenderPolicy
. The following stringy enums are available.
export module Policy {
export var IMMEDIATE = "immediate";
export var ANIMATION_FRAME = "animationframe";
export var TIMEOUT = "timeout";
}
Animator
- All plot
Animator
s now have keys of "main" and "reset" for theAnimator.Baseline()
andAnimator.Null()
states, respectively.
1.0.0 Release Candidate 2
Overview
Why 1.0.0?
There are a number of known issues in the Plottable API that require breaking backwards compatibility to fix. That means there are a number of backwards-incompatible changes in this release. We are working hard to remedy these problems, and get the API in a state that will allow us to maintain backwards compatibility for all releases after v1.0.0.
To provide the best experience to our users, we are rolling out incremental release candidate releases to allow for pre-integration testing. These release candidates are not meant for production, but are meant as testing resources.
Theme of the 1.0.0-rc series
Because of the breaking changes between v0.54.0 and v1.0.0, our goal is that these release candidates will help make the upgrade as smooth as possible for you all, by allowing you to test early, and often.
Please test with these release candidates and make sure you're able to migrate to the new feature set without losing functionality. If you encounter any issues, please file issues here.
A description of the major changes is below. Full instructions on migrating from v0.54.0 to v1.0.0 will be kept updated in our Upgrading to 1.0.0 Guide
API Changes between 1.0.0-rc1 and 1.0.0-rc2
The changes below outline updates to the API that were not included in the 1.0.0-rc1 release.
Core.Colors
Core.Colors
has been deleted. Since the default Plottable colors are now driven by CSS, you can retrieve the colors using:
var colors = new ColorScale().range();
Plots
generateProjectors()
has been removed.
Plots.Bar
The orientation of Plots.Bar
is now set as follows:
new Plots.Bar(xScale, yScale, Plots.Bar.ORIENTATION_VERTICAL);
new Plots.Bar(xScale, yScale, Plots.Bar.ORIENTATION_HORIZONTAL);
Plots.StackedPlot
StackedPlot
was transformed into a set of static
utilities called Plottable.StackedPlotUtils
. This will move to Plots.StackedPlotUtils
in rc3.
Plots.XYPlot
The methods automaticallyAdjustXScaleOverVisiblePoints()
and automaticallyAdjustYScaleOverVisiblePoints()
have been combined into a single method, autorange()
. The autorange functionality is now set as follows:
xyPlot.autorange("x"); // to adjust the x scale based on the y domain
xyPlot.autorange("y"); // to adjust the y scale based on the x domain
xyPlot.autorange("none"); // to disable this functionality completely.
Legend
.sortFunction()
->.comparator()
Accessor
- The signature for an
Accessor
has been changed to not include thePlotMetadata
as an argument:
export interface Accessor<T> {
(datum: any, index: number, dataset: Dataset): T;
}
Label
orientation(orientation: string)
is nowangle(angle: number)
- The orientation is no longer set in the constructor:
var label = new Plottable.Components.Label("My label");
label.angle(-90); // rotated 90 degrees counter-clockwise
Domainer
functionality moved to QuantitativeScale
Domainer
s have been removed. Domainer
s were previously used when autoDomain()
-ing a QuantitativeScale
; their functionality has been moved to the QuantitativeScale
itself:
padProportion(): number;
padProportion(padProportion: number): QuantitativeScale<D>;
addPaddingException(key: any, exception: D): QuantitativeScale<D>;
removePaddingException(key: any): QuantitativeScale<D>;
addIncludedValue(key: any, value: D): QuantitativeScale<D>;
removeIncludedValue(key: any): QuantitativeScale<D>;
domainMin()
and domainMax()
Two methods have been added for setting only one end of the domain on QuantitativeScale
:
domainMin(min)
sets the lower end of the domain.domainMax(max)
sets the upper end of the domain.
If only one is set, the other end of the scale will behave as though it was autoDomain()
-ed. The methods can also be used to retrieve the current min and max values of the domain.
Calling both domainMin(min)
and domainMax(max) is equivalent to calling
domain([min, max]). Setting both can reverse the domain on
QuantitativeScale`s that support reversal.
Calling autoDomain()
will clear both set values, the same way calling autoDomain()
overrides domain()
.
Example fiddle: http://jsfiddle.net/temt44gx/7/
1.0.0 Release Candidate 1
Overview
Why 1.0.0?
There are a number of known issues in the Plottable API that require breaking backwards compatibility to fix. That means there are a number of backwards-incompatible changes in this release. We are working hard to remedy these problems, and get the API in a state that will allow us to maintain backwards compatibility for all releases after v1.0.0.
To provide the best experience to our users, we are rolling out incremental release candidate releases to allow for pre-integration testing. These release candidates are not meant for production, but are meant as testing resources.
Theme of the 1.0.0-rc series
Because of the breaking changes between v0.54.0 and v1.0.0, our goal is that these release candidates will help make the upgrade as smooth as possible for you all, by allowing you to test early, and often.
Please test with these release candidates and make sure you're able to migrate to the new feature set without losing functionality. If you encounter any issues, please file issues here.
A description of the major changes is below. Full instructions on migrating from v0.54.0 to v1.0.0 will be kept updated in our Upgrading to 1.0.0 Guide
Major changes
Replacing project()
project()
previously performed a lot of magic in the background. For example, calling
plot.project("fill", function(d) { return "red"; });
would set the "fill"
attribute in the DOM to "red"
, but calling
plot.project("x", ...);
set a variety of DOM attributes depending on what kind of Plot
was used.
Furthermore, if the second argument to project()
was a string
, it would automatically be used as a key into the data (unless the string began with "#"...), meaning that .project("fill", "red")
didn't do what might be expected.
We have decided to remedy this by splitting the functionality of project()
into different functions.
Using attr()
to set attributes
attr()
previously existed as an alias for project()
. Now, it directly sets DOM attributes to the results of an Accessor
and a Scale
:
attr(attr: string, attrValue: number | string | Accessor<number> | Accessor<string>): Plot;
attr<A>(attr: string, attrValue: A | Accessor<A>, scale: Scale<A, number | string>): Plot;
Example invocations:
plot.attr("stroke-width", 2);
plot.attr("fill", "pink");
plot.attr("fill", function(d) { return d.value >= 0 ? "green" : "red"; });
plot.attr("stroke", function(d) { return d.type; }, colorScale);
The Scale
must be passed as the third argument for it to autoDomain()
over the data passing through it.
attr()
can also be invoked at as a getter that returns the Accessor
-Scale
binding for a particular attribute:
interface AccessorScaleBinding {
accessor: Accessor;
scale?: Scale;
}
Property setters
There are now methods for setting Plot
properties that are not actual DOM attributes. These have a similar signature to attr()
, taking in an Accessor
function and a Scale
. An Accessor
has this signature:
interface Accessor<T> {
(datum: any, index: number, dataset: Dataset, plotMetadata: Plots.PlotMetadata): T;
}
Note that the third argument is now the Dataset
, rather than just the metadata()
from the Dataset
.
Here's an example property setter:
x(x: number | Accessor<number>): XYPlot<X, Y>;
x(x: X | Accessor<X>, xScale: Scale<X, number>): XYPlot<X, Y>;
x()
is used to set the "x" property on an XYPlot
: the previous invocation would have been something like project("x", function(d) { return d.x; }, xScale)
. Now, instead:
plot.x(function(d) { return d.x; }, xScale);
Here is the list of property setters:
- All
XYPlot
s:x()
andy()
Plots.Area
:y0
Plots.Grid
:x2()
andy2()
Plots.Pie
:innerRadius()
,outerRadius()
, andsectorValue()
Plots.Scatter
:size()
andsymbol()
Methods and Fields Renamed
A number of methods and protected fields have changed. These are documented in the upgrading guide: https://github.com/palantir/plottable/wiki/Upgrading-to-1.0.0
Bugfixes
Interaction.PanZoom
now works well when attaching aScale.ModifiedLog
to it.- Registering
Interaction.PanZoom
before the plot has rendered does not break. - If you were previously using a
Scales.Color
inside anAccessor
:
plot.project("fill", function(d) { return colorScale.scale(d.type); });
The Scale
's domain would have expanded to cover all the data, which was an error. Scale
s must be passed as the third argument to attr()
(or the second argument to the property setters) for the Scale
to autoDomain()
over all the data. Instead, do this:
plot.attr("fill", function(d) { return d.type; }, colorScale);
Interaction Changes
Good evening,
Today's release includes an upgrade to Axis.Time
, a new implementation for drag boxes, and a few other Interaction
upgrades.
Features
Arbitrary number of tiers on Axis.Time
Previously, Axis.Time
supported a maximum of two tiers; now it supports any number of tiers. To use this feature, pass a larger number of TierConfiguration
s into the axisConfigurations()
method:
var twoTierAxisConfig = [
tier1Config,
tier2Config
];
var threeTierAxisConfig = [
tier1Config,
tier2Config,
tier3Config
];
timeAxis.axisConfigurations([
twoTierConfig,
threeTierConfig,
...
]);
Try it out: http://jsfiddle.net/xs3zps5w/
Interaction.Drag
Interaction.Drag
has been refactored. You can register for events with the following methods:
onDragStart(callback)
: The callback will be passed the starting point of the drag gesture.onDrag(callback)
: The callback will be passed the starting point and current location of the drag gesture.onDragEnd(callback)
: The callback will be passed the starting point and ending point of the drag gesture.
In addition, setupZoomCallback()
has been removed (it was broken anyway). See the section on Component.DragBoxLayer
to see how to implement this functionality.
Try it out: http://jsfiddle.net/fgns88L7/2/
Component.SelectionBoxLayer
This Component
draws a translucent box in the space it occupies. The bounds of the box can be set using the bounds()
method:
bounds(newBounds: Bounds): SelectionBoxLayer;
A Bounds
object is used to specify the location of the corners of the box:
/**
* The corners of a box.
*/
export type Bounds = {
topLeft: Point;
bottomRight: Point;
}
In a Bounds
object, the topLeft
is always the top-left Point
of the drag box, regardless of how the user is creating or resizing the box.
The box can be shown or hidden using the boxVisible()
method. Note that the visible box does not necessarily occupy all of the space in the SelectionBoxLayer
.
Try it out: http://jsfiddle.net/4pb2yw1y/4/
The box can be re-styled by changing the CSS rules for .plottable .selection-box-layer .selection-area
.
Try it out: http://jsfiddle.net/4pb2yw1y/5/
DragBoxLayer
A DragBoxLayer
is a SelectionBoxLayer
with an Interaction.Drag
already hooked up. You can register for events on DragBoxLayer
:
onDragStart(callback)
onDrag(callback)
onDragEnd(callback)
The callbacks passed to the above methods will be called with the current bounds()
of the box.
Finally, the box can be made resizable by calling resize(true)
on the DragBoxLayer
.
Try it out: http://jsfiddle.net/5L700d8w/
An example showing how to zoom in after a drag: http://jsfiddle.net/sazokb53/
DragBoxLayer
replaces Interaction.DragBox
; see "API-Breaking Changes and Upgrade Instructions" for how to make the transition.
XDragBoxLayer
and YDragBoxLayer
These are subclasses of DragBoxLayer
that only allow selection in a single dimension.
Try them out: http://jsfiddle.net/5fpvyzu0/
Interaction.DoubleClick
Interaction.DoubleClick
has been refactored. You can register for the double-click event with the following method:
onDoubleClick(callback)
: The callback will be passed the point that was double-clicked.
Note that a double-click event is defined by two consecutive mouse click-downs and click-ups within the span of the system-determined double-click speed.
Try it out: http://jsfiddle.net/gzo2vjha/
Dispatcher.Touch
can work on multiple touches
The callbacks in the API for Dispatcher.Touch
now have a different signature to account for multiple touches:
type TouchCallback = (ids: number[], idToPoint: { [id: number]: Point; }, e: TouchEvent) => any;
Each Touch has a unique identifier, stored in the ids
array. idToPoint
stores the location of the touch with a given identifier.
Bugfixes
Interaction.Drag
now works under CSS transforms (#1497) and zooming in IE9 (#1491).- Constrained tick labels on
Axis.Numeric
now display better (#1118). Component
s that are already rendered can be moved intoGroup
s (1823.Plot.StackedBar
,Plot.StackedArea
,Plot.Pie
, andPlot.Grid
now handleNaN
andundefined
data more gracefully (#1838, #1844, #1850, #1851)
API-Breaking Changes and Upgrade Instructions
Interaction.Drag
callbacks
The methods for registering callbacks on Interaction.Drag
have been renamed, although the signatures of the callbacks passed in have not:
.dragstart()
→onDragStart()
.drag()
→onDrag()
.dragend()
→onDragEnd()
Component.DragBoxLayer
replaces Interaction.DragBox
To add a drag box to a Plot
:
New way: Create a Component.DragBoxLayer
and combine it with the Plot
using a Group
.
- example: http://jsfiddle.net/77p0z2mj/1/
Old way: Create an Interaction.Dragbox
and register it to the Plot
.
- example: http://jsfiddle.net/dLz743gd/5/
The methods for registering callbacks on DragBoxLayer
have also been renamed:
.dragstart()
→onDragStart()
.drag()
→onDrag()
.dragend()
→onDragEnd()
Callbacks registered to onDragStart()
, onDrag()
, and onDragEnd()
are now passed the Bounds
of the DragBoxLayer
:
export type Bounds = {
topLeft: Point;
bottomRight: Point;
}
The CSS classes associated with a drag box have also changed, as well as the default stylings. To control the appearance of the box on DragBoxLayer
, CSS classes should be set on .drag-box-layer .selection-area
. For example, the following code will make the drag box look as it did on previous versions:
.plottable .drag-box-layer .selection-area {
fill: aliceblue;
fill-opacity: .7;
stroke: #C0C8FF;
}
Release Song
Two Weeks, Grizzly Bear: https://www.youtube.com/watch?v=sPXDJQkuWeA
Improvements to getClosestPlotData()
Good afternoon,
This release features more nuanced default behavior for getClosestPlotData()
.
Features
Improvements to getClosestPlotData()
We've simplified the API. It now accepts a query point only:
getClosestPlotData(queryPoint: Point): PlotData;
and the notion of "closest" differs by plot type:
Scatter
,Pie
, andGrid
Plot
s retain the Euclidean normLine
andArea
Plot
s implement an x-then-y strategy; points are first compared by x-value and, if multiple points have the same x-value, their y-value is used as a tiebreakerBar
Plot
s implement a similar x-then-y strategy, with the addition that bars containing the query point are always returned. For horizontalBar
Plot
s, the strategy is y-then-x.
This makes it easy to show plot data tooltips in a user-friendly way.
Try it out here: http://jsfiddle.net/38ehL9p6/1/
Bugfixes
- Plottable stops reading colors from CSS when a maximum of 256 colors is reached (#1834)
Typescript-only API-Breaking Changes
getClosestPlotData()
no longer accepts the two (optional) parameterswithinValue
anddatasetKeys
.
Component.Group improvements, refactored Interaction.Click
Good afternoon,
Today's release features improvements to Component.Group
, as well as a refactoring of Interaction.Click
.
Features
Adding Component
s to filled cells in Table
Adding a Component
to a Table
cell that is already occupied will now merge it above the Component
that is already there, creating a Group
. If the Component
being added or the Component
already there is a Group
, they will be combined using above()
.
See it in action: http://jsfiddle.net/3h567a36/1/
Interaction.Click
Restructured
Interaction.Click
now uses the new Interaction
architecture -- this means it will now return the correct position even when CSS transforms have been applied to the page. The callback registration method has been renamed to onClick()
.
Example Usage:
var clickInteraction = new Plottable.Interaction.Click();
clickInteraction.onClick(function(point){
// do something with the resultant Point -- maybe select an element?
...
});
plot.registerInteraction(clickInteraction);
See it in action: http://jsfiddle.net/uztbyhnz/1/
Bugfixes
Component.Group
no longer produces extra whitespace. Essentially,Group
will behave with the combined effect of each of its constituentComponent
s added to aTable
cell individually (#1791).- An
Axis.Time
with only single-tier configurations no longer occupies extra space where the extra tier would have been (#1800).
API-Breaking Changes
Interaction.Click
'scallback
setter has been replaced with anonClick
getter/setter API.
Upgrade Instructions
- In places where you are using
clickInteraction.callback(callback)
, this should be replaced withclickInteraction.onClick(callback)
.
Release Song
Jason Mraz - Geek in the Pink