diff --git a/API.txt b/API.txt index b2ace0a..7714723 100644 --- a/API.txt +++ b/API.txt @@ -524,6 +524,7 @@ Customizing the data series points: { radius: number + symbol: "circle" or function } bars: { @@ -590,6 +591,26 @@ connected with a straight (possibly diagonal) line or with first a horizontal and then a vertical line. Note that this transforms the data by adding extra points. +For points, you can specify the radius and the symbol. The only +built-in symbol type is circles, for other types you can use a plugin +or define them yourself by specifying a callback: + + function cross(ctx, x, y, radius, shadow) { + var size = radius * Math.sqrt(Math.PI) / 2; + ctx.moveTo(x - size, y - size); + ctx.lineTo(x + size, y + size); + ctx.moveTo(x - size, y + size); + ctx.lineTo(x + size, y - size); + } + +The parameters are the drawing context, x and y coordinates of the +center of the point, a radius which corresponds to what the circle +would have used and whether the call is to draw a shadow (due to +limited canvas support, shadows are currently faked through extra +draws). It's good practice to ensure that the area covered by the +symbol is the same as for the circle with the given radius, this +ensures that all symbols have approximately the same visual weight. + "shadowSize" is the default size of shadows in pixels. Set it to 0 to remove shadows. diff --git a/NEWS.txt b/NEWS.txt index f21e95a..17428b7 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -64,6 +64,9 @@ Changes: ensure that they appear next to each other rather than in between, at the expense of possibly awkward tick steps (sponsored by Flight Data Services, www.flightdataservices.com). +- Support for customizing the point type through a callback when + plotting points and new symbol plugin with some predefined point + types (sponsored by Utility Data Corporation). - New hooks: drawSeries diff --git a/examples/index.html b/examples/index.html index 2406e3e..75b2fc4 100644 --- a/examples/index.html +++ b/examples/index.html @@ -32,6 +32,7 @@
Various features: