@quartic/bokehjs
Version:
Interactive, novel data visualization
40 lines (30 loc) • 1.16 kB
text/coffeescript
import {XYGlyph, XYGlyphView} from "./xy_glyph"
import * as p from "core/properties"
export class ArcView extends XYGlyphView
_map_data: () ->
if .properties.radius.units == "data"
= (.xmapper, , )
else
=
_render: (ctx, indices, {sx, sy, sradius, _start_angle, _end_angle}) ->
if .line.doit
direction = .properties.direction.value()
for i in indices
if isNaN(sx[i]+sy[i]+sradius[i]+_start_angle[i]+_end_angle[i])
continue
ctx.beginPath()
ctx.arc(sx[i], sy[i], sradius[i], _start_angle[i], _end_angle[i], direction)
.line.set_vectorize(ctx, i)
ctx.stroke()
draw_legend_for_index: (ctx, x0, x1, y0, y1, index) ->
(ctx, x0, x1, y0, y1, index)
export class Arc extends XYGlyph
default_view: ArcView
type: 'Arc'
['line']
{
direction: [ p.Direction, 'anticlock' ]
radius: [ p.DistanceSpec ]
start_angle: [ p.AngleSpec ]
end_angle: [ p.AngleSpec ]
}