A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/palantir/plottable/wiki/Upgrading-to-3.0.0 below:

Upgrading to 3.0.0 · palantir/plottable Wiki · GitHub

🎉 We are pleased to announce Plottable v3.0.0! 3.0.0 brings a host of performance improvements and new features, as well as modernizing the codebase and the ways in which users consume the library. Please read on for a list of breaking changes and upgrade steps.

Breaking Changes

  1. [ACTION REQUIRED] .renderTo() only accepts HTML elements
  2. CDN changes
  3. Removing bower support
  4. d3 v4
  5. module format
  6. Typescript changes
  7. API changes
  8. Dropping IE9 support

Features

  1. Canvas Rendering
  2. BarPlot barAlignment
  3. BarPlot barEnd
  4. Axis interactions
  5. CategoryAxis tickLabelShearAngle

Improvements

Bugfixes

Previously, Components only understood SVG elements and had to be rendered to an SVG. Components now work with generic HTML elements, opening the way for more improvements such as canvas rendering. This introduces the following breaking changes:

[ACTION REQUIRED] .renderTo() only accepts HTML elements

Components now must .renderTo() an HTML element, not an <svg>. All users will need to modify the element they are passing to .renderTo() (or .anchor()) appropriately.

old:
<svg width="300" height="300"></svg>

new:
<div style="width: 300px; height: 300px"></div>
  1. content/foreground/background/box-container are now <svg>s instead of <g>s
  2. Table and Group now place their children on the .component element instead of on the .content.
CDN changes - rawgit.com no longer supported, cdnjs.com no longer supported

rawgit.com will no longer work as a CDN for newer versions of Plottable. We recommend using npm and webpack to bundle Plottable with your application. If that's not possible, you may use unpkg.com.

If on develop: https://rawgithub.com/palantir/plottable/develop/plottable.js --> //unpkg.com/plottable@latest/plottable.js

If on a specific version: https://rawgithub.com/palantir/plottable/v3.0.0-beta.1/plottable.js --> //unpkg.com/plottable@v3.0.0-beta.1/plottable.js

Similarly, we are no longer supporting cdnjs.com and it may break in the future. Use unpkg instead.

Bower is an outdated package manager and we have dropped support for it. Please use yarn/npm instead.

We now use d3 v4.5.0, which opens the door to many bugfixes and general improvements. You will need to upgrade your d3 dependency to point to 4.5.0 or higher accordingly:

Script tag:

<!-- old -->
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.16/d3.js"></script>
<!-- new -->
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/4.5.0/d3.js"></script>

requireJS:

require.config({
    paths: {
        // old
        d3: "https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.16/d3",
        // new
        d3: "https://cdnjs.cloudflare.com/ajax/libs/d3/4.5.0/d3",
    },
});

If you use d3 elsewhere, that code will need to be upgraded to v4 semantics. See Changes in D3 4.0.

The upgrade to d3v4 has also cause some API changes:

.interpolator() has been renamed to .curve(). .interpolator() used to take strings of the form "linear-closed", coinciding with d3v3 easing names. These are now camelCased ("linear-closed" -> "linearClosed"). Here's the full list of accepted curve names. It also now accepts a d3.curveFactory:

linePlot.curve(d3.curveCatmullRom.alpha(0.5))

See d3-shape#curves for more info.

EasingAnimator.easingMode() used to take strings of the form "exp-in-out", coinciding with d3v3 easing names. These are now camelCased ("exp-in-out" -> "expInOut"). Here's the full list of accepted easing names. It also now accepts an arbitrary mapping function:

animator.easingMode((t) => Math.sin(t * Math.PI))

See d3-ease for more info.

The codebase is now written in ES2015 Module format and we now publish our modules on npm. The npm package contains our modules and typings.

Users should be able to pull in just the parts of Plottable they care about using import statements:

// import just the Category Axis
import { Category } from "plottable/build/src/axes/categoryAxis";

Upon upgrading, Typescript consumers may see "cannot be named" errors like:

Error:(16, 17) TS4058:Return type of exported function has or is using name 'Scale' from external module "<path>/plottable/build/src/scales/scale" but cannot be named.

This occurs when your module exports a Plottable type. The recommended fix is to explicitly type the exported type:

// bad
export const k = new Plottable.Plots.Bar();

// good
export const k: Plottable.Plots.Bar = new Plottable.Plots.Bar();

All Typescript interfaces now have an I prepended to them:

// old
var entity: Plottable.Entity... // no exported member Entity

// new
var entity: Plottable.IEntity
Minimum required version TS2.1

Our .d.ts files now use the keyof operator which only exists on Typescript 2.1 and above. Upgrade to Typescript 2.1 to prevent compile errors.

If you depend on @types/d3, you will need to upgrade your codebase to use @types/d3@4.5.0.

Some methods now get/set string literal union types

Plottable.Axes.Time.tierLabelPositions(), Plottable.Axes.Time.maxTimeIntervalPrecision(), Component.xAlignment(), Component.yAlignment(), and Plottable.RenderController.renderPolicy() now get/set string literal union types that define exactly the set of acceptable strings. Typescript may throw errors in places that previously worked:

Old:

var xAlign = "left";
component.xAlignment(xAlign); // Argument of type 'string' is not assignable to parameter of type '"left" | "center" | "right"'.

New:

var xAlign: Plottable.XAlignment = "left";
// or
const xAlign = "left";

component.xAlignment(xAlign);
// or
component.xAlignment("left");
Plottable.Components.Alignment renamed Plottable.RenderController.Policy enum members camelCased Plottable.Plots.Bar.ORIENTATION_VERTICAL and ORIENTATION_HORIZONTAL renamed

Component's .bounding-box element has been removed. Use the .element() method to get the DOM element that bounds a Component.

Component's .background-fill element has been removed. This was added so users could add a background color using CSS chart. Instead, style the .component selector.

Old:

#myChart .background-fill {
  fill: "red";
}

New:

#myChart .component {
  background-color: "red";
}

The DoubleClick interaction has been combined with Click and internally controls overlap between the two events.

// old:

var singleClick = new Plottable.Interactions.Click();
var doubleClick = new Plottable.Interactions.DoubleClick();

singleClick.onClick(...) // will fire on both physical click instances
doubleClick.onDoubleClick(...)

// new:

var click = new Plottable.Interactions.Click();
click.onClick(...) // only fires on the first physical click
click.onDoubleClick(...) // only fires on the physical click corresponding to a double-click

Dispatchers.Mouse.getDispatcher and Dispatchers.touch.getDispatcher should now be passed Components instead of SVG elements.

eventInsideSVG renamed to eventInside and now must be passed the Component to test as the first argument.

We are bumping our minimum supported version of Internet Explorer from 9 to 11. IE9 is no longer supported by Microsoft and users are recommended to upgrade to a newer browser. Future releases should not be expected to have IE9 compatibility.

Canvas Rectangle Plot and Bar Plot

Rectangle plot and bar plot are supported, supporting the stroke-width, stroke, fill, and opacity attributes.

Rendering Line Plot onto Canvas, supporting the stroke, stroke-width, and opacity attributes.

BarPlot now exposes a barAlignment("start" | "middle" | "end") property that determines whether the .x() accessor defines the start, middle, or end of the bar being drawn.

BarPlot now also exposes a barEnd() that controls the width of the bar. This together with barAlignment() allows more direct control over the start and end coordinates for each bar and helps build histogram-like plots.

Add Axis.tickLabelDataOnElement, which gets the data value for a tick label. This allows users to implement behaviors based on interacting with a tick label:

clickInteraction.onClick((point, event) => {
  const dataValue = axis.tickLabelDataOnElement(event.target);

  console.log("clicked on value", dataValue);
}).attachTo(axis);
CategoryAxis tickLabelShearAngle

Added tickLabelShearAngle property to CategoryAxis to enable shearing of long tick label text.

The existing tickLabelRotationAngle property can only rotate the text in the four cardinal directions, but tickLabelShearAngle can be any number of degrees from -80 to 80.

Note that while the lines of sheared text will still be wrapped within the bounds of the "primary" dimension (i.e. "width" in non-rotated text), the text may overflow the bounds of the "secondary" dimension (i.e. "height" in non-rotated text).

We've added enum objects for the following enums:

This makes it convenient to see what options are available in an enum and makes the code more readable:

new Plottable.Axes.Category(scale, Plottable.AxisOrientation.right);

Thanks,

Plottable Team


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4