Jquery flot, different size and color for each dot

Can we change the following properties of points on the jquery plot graph:

size of dots . I am basically trying to build a three-dimensional graph. The first two dimensions are the x and y values, and the third dimension will be reflected in the size of the dots. The larger the value, the larger the point.

dot color: Again, I'm trying to display a property other than the x and y values. the larger the value, the darker the dot.

[EDIT] : I am trying to control these properties for points separately, and not for the entire graph.

+7
source share
1 answer

I understand you now. The only way I can do this is to pass the callback function to the dot character parameter:

function someFunc(ctx, x, y, radius, shadow) { someFunc.calls++; if (someFunc.calls % 2 == 0) { ctx.arc(x, y, radius * 4, 0, shadow ? Math.PI : Math.PI * 2, false); } else { ctx.arc(x, y, radius, 0, shadow ? Math.PI : Math.PI * 2, false); } } someFunc.calls = 0; var options = { series: { lines: { show: true }, points: { show: true, symbol: someFunc} } }; somePlot = $.plot($("#placeholder"), [ d1 ], options); 

In the above example, I adjust the size of the radius for every other point:

enter image description here

EXAMPLE HERE

+16
source

All Articles