var xScale = new Plottable.Scales.Category();
var yScale = new Plottable.Scales.Linear();
var data = [{ x: 1, y: 1 }, { x: 2, y: 3 }, { x: 3, y: 2 },
{ x: 4, y: 4 }, { x: 5, y: 3 }, { x: 6, y: 5 }];
var plot = new Plottable.Plots.Scatter()
.addDataset(new Plottable.Dataset(data))
.x(function(d) { return d.x; }, xScale)
.y(function(d) { return d.y; }, yScale)
.renderTo("svg#example");
window.addEventListener("resize", function() {
plot.redraw();
});
.size()
/.size(size)
/.size(size, scale)
Gets or sets the AccessorScaleBinding for the size property of the plot. The size
parameter can either be a number or an Accessor
function. If the scale
parameter is set, the size will be scaled accordingly.
var plot = new Plottable.Plots.Scatter()
.addDataset(new Plottable.Dataset(data))
.x(function(d) { return d.x; }, new Plottable.Scales.Linear())
.y(function(d) { return d.y; }, new Plottable.Scales.Linear())
.size(50)
.renderTo("svg#size");
.symbol()
/.symbol(symbol)
Gets or sets the AccessorScaleBinding for the symbol property of the plot. The symbol property corresponds to how the symbol will be drawn. The symbol
parameter is an Accessor
that returns a SymbolFactory
.
var plot = new Plottable.Plots.Scatter()
.addDataset(new Plottable.Dataset(data))
.x(function(d) { return d.x; }, new Plottable.Scales.Linear())
.y(function(d) { return d.y; }, new Plottable.Scales.Linear())
.symbol(function(d) { return new Plottable.SymbolFactories.cross() })
.renderTo("svg#symbol");