I can in the same series multiple types of symbol? I have a graph, where the point 5 shall be a circle and point 6 and 8 a other, and connected to each other
No, you can't plot a series using multiple symbols, but you can get the same effect by plotting multiple series, each with their own symbol and subset of the same data. This requires the jquery.flot.symbol
plugin.
For example, we have this data to plot:
data: [
[0, 150],
[1, 175],
[2, 190],
[3, 160],
[4, 140],
[5, 150],
[6, 200],
[7, 170],
[8, 155],
[9, 165],
[10, 160],
[11, 145]
]
We can create a series to plot just the line by setting points.show
to false
and lines.show
to true
(example):
var series = [{
data: [ [0, 150], [1, 175], [2, 190], [3, 160], [4, 140], [5, 150], [6, 200], [7, 170], [8, 155], [9, 165], [10, 160], [11, 145] ],
points: { show: false },
lines: { show: true },
color: "#81A0C1"
}];
We can then add another series to plot symbols for a subset of the data by setting points.show
to true
and lines.show
to false
. We can also specify which symbol to plot by setting points.symbol
(example):
var series = [{
data: [ [0, 150], [1, 175], [2, 190], [3, 160], [4, 140], [5, 150], [6, 200], [7, 170], [8, 155], [9, 165], [10, 160], [11, 145] ],
points: { show: false },
lines: { show: true },
color: "#81A0C1"
},
{
data: [ [4, 140], [9, 165], [10, 160], [11, 145] ],
points: {
show: true,
symbol: "cross"
},
lines: { show: false },
color: "#81A0C1"
}];
We can add yet another series, again by setting points.show
to true
and lines.show
to false
, and choose a different subset of data and symbol (example):
var series = [{
data: [ [0, 150], [1, 175], [2, 190], [3, 160], [4, 140], [5, 150], [6, 200], [7, 170], [8, 155], [9, 165], [10, 160], [11, 145] ],
points: { show: false },
lines: { show: true },
color: "#81A0C1"
},
{
data: [ [4, 140], [9, 165], [10, 160], [11, 145] ],
points: {
show: true,
symbol: "cross"
},
lines: { show: false },
color: "#81A0C1"
},
{
data: [ [0, 150], [3, 160], [5, 150], [7, 170], [8, 155] ],
points: {
show: true,
symbol: "circle"
},
lines: { show: false },
color: "#81A0C1"
}];
This process can be repeated for all data points, and it's up to your implementation to decide how points are grouped into each symbol. In this example, I've set the color of each series to the same color, but you can also use different colors for each series if you want different symbols to have different colors.
This JSFiddle shows the full example.