Scatter chart presents a set of points which are displayed based on two coordinates (data values) - one for the X-axis and another one for the Y-axis - provided in a data set.
Presets simplify chart initialization and contain item settings. They are defined by the preset property and can be of the following types:
Related sample: Scatter Chart: Style Presets
Chart series allow presenting different graphs within one and the same chart. The graphs differ in color. Settings for the graphs form objects that are placed into the series array.
Related sample: Scatter Chart: Several Graphs in One Chart
See the common rules of series definition here.
With chart series, legend should be used to distinguish between graph values. At the same time, legend markers become clickable and allow you to show and hide dedicated graphs.
By default, Scatter chart renders just points presenting data items. However, you can also render various graphs in Scatter Chart by connecting points by lines, and even draw shapes out of lines.
Related sample: Scatter Chart: Points, Shapes and Lines
You can connect points of the Scatter chart by lines.
Points will be connected in the order provided by the dataset (by the y-coordinate). For the above example the data set is the following:
var scatter_dataset = [
{ "a":1, "d":6 },
{ "a":3, "d":3 },
{ "a":6, "d":8 },
{ "a":10, "d":6 },
{ "a":13, "d":11 },
{ "a":16, "d":5 },
{ "a":19, "d":14 }
];
In order to render lines in the Scatter Chart:
webix.ui({
view:"chart",
type:"scatter",
xValue: "#a#",
// scales config
series:[
//line
{
shape:false,
value:"#d#",
disableItems:false,
disableLines:false,
item:{
color: "#ffcf4d",
borderColor:"#ff4000",
type: "d",
radius:5
},
line:{
color:"#ffcf4d",
width:2
}
}
],
data:scatter_dataset
});
A shape presents a set of points connected by lines, where the last point is connected to the first one.
The order of connection is defined by the data set (by the y-coordinate). The data set given below is used to render the shape:
var scatter_dataset = [
{ "a":5, "b":4 },
{ "a":3, "b":8 },
{ "a":5, "b":16 },
{ "a":9, "b":16 },
{ "a":16, "b":9 },
{ "a":10, "b":4 }
];
To create a shape graph on a chart, you should use several series configuration options:
webix.ui({
view:"chart",
type:"scatter",
xValue: "#a#",
// scales config
series:[
//area
{
value:"#b#",
shape:true,
disableItems:true,
disableLines:false,
line:{
color:"#73b2de",
width:2
},
fill:"#73b2de"
}],
data:scatter_dataset
});
Back to top