in src/plotxy.tsx [352:404]
function render_dp(dp, ctx, c) {
if (c.lines_color) ctx.strokeStyle = c.lines_color;
if (c.dots_color) ctx.fillStyle = c.dots_color;
if (c.lines_width) ctx.lineWidth = c.lines_width;
var pdx = me.props.params_def[me.state.axis_x];
var pdy = me.props.params_def[me.state.axis_y];
function is_err(value, scaled_value, def) {
return value === undefined || value === null || isNaN(scaled_value) || (def.numeric && (value == 'inf' || value == '-inf'));
}
function render_point_position(dp) {
var x = x_scale(dp[me.state.axis_x]);
var y = y_scale(dp[me.state.axis_y]);
x -= margin.left;
y -= margin.top;
var err = is_err(dp[me.state.axis_x], x, pdx) || is_err(dp[me.state.axis_y], y, pdy);
if (err) {
return null;
}
if (c.remember) {
currently_displayed.push({
'layerX': x + margin.left,
'layerY': y + margin.top,
'dp': dp
});
}
return {x: x, y: y};
}
var pos = render_point_position(dp);
if (pos === null) {
return;
}
if (dp.from_uid && c.lines_width > 0.0) {
var dp_prev = me.props.dp_lookup[dp.from_uid];
if (dp_prev) {
var prev_pos = render_point_position(dp_prev);
if (prev_pos !== null) {
ctx.beginPath();
ctx.moveTo(prev_pos.x, prev_pos.y);
ctx.lineTo(pos.x, pos.y);
ctx.stroke();
}
}
else {
console.log('DataPoint with id ' + dp.from_uid + ' not found (dp.from_uid)', dp);
}
}
if (c.dots_thickness > 0) {
ctx.beginPath();
ctx.arc(pos.x, pos.y, c.dots_thickness, 0, 2 * Math.PI, true);
ctx.fill();
}
};