PlotKit Home | >>

PlotKit Base

PlotKit Base contains a number of simple functions that are needed for the rest of the PlotKit libraries.

PlotKit.Base Functions

Given an array, it will collapse all the values from the passed array into one big array.

[[1,2], [3,4], [5,6]] --> [1, 2, 3, 4, 5, 6]

Returns the X value of the element relative to the document in a browser independent way.

Returns the Y value of the element relative to the document in a browser independent way.

Takes in a base colour and generates a palette of colours based on the intensive levels.

Rounds a number to a specified precision. TODO: make more robust

Acts like the UNIX uniq, takes a sorted array and returns a new array that only contains uniq elements.

Returns true if it is of type function.

Checks whether the javascript runtime is polluted by prototype.js

A version of MochiKit.Base.items() that is aware of prototype.js

A version of MochiKit.Base.keys() that is aware of prototype.js

A version of MochiKit.Base.map() that is aware of prototype.js

Preset Styles

Color Schemes

There are some colour schemes, which are an array of MochiKit.Color.Colors.

A default colour scheme that consists of red, orange, yellow, green, cyan, blue, purple and magenta.

A set of five dark colours.

A set of five bright primary colours.

Three colour set that have a nice professional blue hue.

Office Style

These are base styles that were inspired by charts in Office 12. The color schemes are fairly similar to those found in screenshots of charts available online.

Contains the basic style independent of colours.

Blue colors: bluecolors

Red colors: redcolors

Green colors: greencolors

Purple colors: purplecolors

Cyan colors: cyancolors

Orange colors: orangecolors

Black colors: blackcolors

Usage

var layout = PlotKit.Layout("bar", officeOrange());