I am trying to create a scatter plot using velocity. I am having limited succes using the examples provides so I hava a couple of questions.
- I would like to display 2 series in one scatter. Each using a different color. Is this possible?
- I am having trouble with the scales of the x and y axes. They seem to always show a 0-100 range. I can not seem to set them. My values are always low (10-25) so my data point are displayed in the left corner. I made a 'dirty' fis by calculating the numbers as percentages. But this is not ideal.
- I do not see the legend for the axes. I must set them wrong, but do not know how to.
This is the test-code I am using. Sample data off course:
- Code: Select all
var vContextObject = new Object();
vContextObject.fromString = true;
//var vEpisode = forms.care_episode.foundset.getSelectedRecord();
//var vPerson = forms.care_person.foundset.getSelectedRecord();
var xBase = 25;
var yBase = 25;
var chartDef = {};
chartDef.width = 400;
chartDef.height = 350;
chartDef.title = "Follicle growth";
chartDef.margins = [ 0, 10, 0, 10 ];
chartDef.legendMargins = { h: 30, v: 20 };
chartDef.scatter = {xData: [(3/xBase)*100,(5/xBase)*100,(5/xBase)*100,(10/xBase)*100,(15/xBase)*100,(15/xBase)*100,(20/xBase)*100],
yData: [(15/xBase)*100,(16/xBase)*100,(15/xBase)*100,(18/xBase)*100,(18/xBase)*100,(20/xBase)*100,(21/xBase)*100],
//yData: [15,16,15,18,18,20,21],
color: "#FF0000",
legend: "Left ovary"
};
chartDef.xMin = 0;
chartDef.yMin = 0;
chartDef.xMax = 25;
chartDef.yMax = 25;
chartDef.xAxis = {labels:['1','15','20'],maxRange: 25,title: {text: "Day", size: 10, color: "#FFFFFF"}};
chartDef.yAxis = {labels:['10','20','30'],title: {text: "Follicle size", size: 10, color: "#FCFCFC"}};
chartDef.transparency = 100;
chartDef.background = '#F4F7FA';
vContextObject.chartImg = plugins.VelocityReport.getChart(CHART.SCATTER,chartDef, false, REPORT.RESOLUTION_LOW);
This results is the following graph: https://www.screencast.com/t/8dtMnBQbtkw
My goal is something like this one: https://goo.gl/images/ohefmy
Any help would be welcome.
Regards,
W.