visualizer icon indicating copy to clipboard operation
visualizer copied to clipboard

Spectra Displayer and chart object with color property

Open jobo322 opened this issue 9 years ago • 4 comments

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

jobo322 avatar Jan 10 '17 14:01 jobo322

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

lpatiny avatar Jan 11 '17 16:01 lpatiny

@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

lpatiny avatar Jan 11 '17 16:01 lpatiny

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

NPellet avatar Jan 11 '17 21:01 NPellet

It is working now in the HEAD.

andcastillo avatar Jan 19 '17 19:01 andcastillo