Spectra Displayer and chart object with color property
The "spectra displayer" module don't draw a chart object with color property in visualizer versions upper to 2.61 In the following view you can observe the problem swich the version of visualizer between 2.61 and 2.63 or higher.
https://my.cheminfo.org/?v=v2.63.1&viewURL=https%3A%2F%2Fmydb.cheminfo.org%2Fdb%2Fvisualizer%2Fentry%2F53c69fe93b8643d0690c769c7d266372%2Fview.json
This is a working test case:
https://my.cheminfo.org/?v=v2.61.0&viewURL=https%3A%2F%2Fmydb.cheminfo.org%2Fdb%2Fvisualizer%2Fentry%2F53c69fe93b8643d0690c769c7d266372%2Fview.json
Indeed it happens between 2.61.0 and 2.63.1
https://github.com/NPellet/visualizer/compare/v2.61.0...v2.63.1
@NPellet
The format of the json looks strange to me:
https://github.com/cheminfo/json-chart/blob/master/examples/colorLine.json
What is the correct way to encode set the color of each segment of a line. It used to work before 2.61.0 meaning before jsgraph 1.15.2
Well there was indeed a problem in line.color
I patched it 1.16.24, but you cannot use markers anymore (you never could actually...)
for( var i = 0; i < Math.PI * 10; i += 0.001 ) {
data.push( i );
data.push( Math.sin( i ) );
colors.push( HSVtoRGB( Math.pow(Math.sin( i ), 2), 0.8, 0.8 ) );
}
var s = graph.newSerie("a", {}, "line.color").autoAxis().setData(data);
s.setColors([ colors ]);
Don't attempt to make a draw if the colors have not been set. I don't even check if they exist and jsGraph will fail if they don't. I opened a ticket to improve this in jsGraph 2
It is working now in the HEAD.