Skip to content

[v1.4.0] Typescript 1.5, Plots.Waterfall, Plots.Pie label Formatter

Choose a tag to compare

@jtlan jtlan released this 24 Jul 23:31
· 1860 commits to master since this release

Overview

Plottable now uses Typescript 1.5! Depending on your version of Typescript you may need to add or delete touch-events.d.ts from your project. Please review the upgrade instructions.

We're excited to introduce a new plot: Plots.Waterfall. New features and bug fixes have been added to Plots.Pie. These changes ensure that labels work as intended and give you the ability to format labels.

Typescript 1.5

Plottable has been upgraded to use Typescript 1.5. The only major change affecting Plottable users at this time is that Typescript 1.5 includes definitions for TouchEvent; consequently, Plottable no longer has a dependency on touch-events.d.ts.

screen shot 2015-07-24 at 3 52 55 pm: Depending on your current version of Typescript, you may need to add or remove touch-events.d.ts. Instructions are here.

Features

Plots.Waterfall

screen shot 2015-07-24 at 12 37 58 pm

Plots.Waterfall has been added as an extension of Plots.Bar. This plot can be used to show how positive and negative deltas affect initial values.

Note that horizontal orientation is not an option for Plots.Waterfall, and .labelsEnabled() has not been implemented yet.

In addition to the traditional .x() and .y() accessors for plots, the following API points have been added:

  • .total()/.total(total) - gets/sets an Accessor which will return true for each data point representing a total, and false for data points representing deltas. The function given to this endpoint must return a boolean.
  • .connectorsEnabled()/.connectorsEnabled(enabled) - gets/sets whether connector lines, indicated below, should be shown.

screen shot 2015-07-24 at 4 24 10 pm

Try it out: http://jsfiddle.net/h91a5pnj/

Formatter for labels on Plots.Pie

screen shot 2015-07-23 at 7 31 42 pm

The labels on Plots.Pie can now be formatted using a Formatter. The new API points on Plots.Pie are:

labelFormatter(): Formatter;
labelFormatter(formatter: Formatter): Plots.Pie;

Try it out: http://jsfiddle.net/xLhh903y/

Bugfixes

  • autorangeMode() now works correctly on Plots.Line and Plots.Segment. Previously, using autorangeMode() would have resulted in larger domains than expected. Now there will be a tight domain around the data on the plot. (#2472).
  • The function passed to Legend's symbol() method now uses the correct indices. This allows you to use the index of a legend entry to change the shape of its icon. (#2106).
  • On Plots.Pie, labels will update when data changes. They are also removed when labelsEnabled() is set to false (#2483).