Hi,
We are trying to draw a trendline on a scatter graph using this example:
http://www.smartclient.com/docs/8.3/a/system/reference/SmartClient_Explorer.html#scatterPlotCharting
Here is the code I'm using so far. I can't figure out how we are supposed to control the x coordinate of the startPoint and endPoint though. And, your feature explorer example only gives a basic example of using this.getChartLeft() and (this.getChartLeft() + this.getChartWidth())?
We are trying to draw a trendline on a scatter graph using this example:
http://www.smartclient.com/docs/8.3/a/system/reference/SmartClient_Explorer.html#scatterPlotCharting
Here is the code I'm using so far. I can't figure out how we are supposed to control the x coordinate of the startPoint and endPoint though. And, your feature explorer example only gives a basic example of using this.getChartLeft() and (this.getChartLeft() + this.getChartWidth())?
Code:
isc.FacetChart.create({
ID: "multiScatterChart",
title:"Multi Scatter",
chartType: "Scatter",
width:700,
showScatterDataLabels:true,
chartBackgroundDrawn : function() {
var values = this.getFacetData().getProperty(["value"]);
var sum = 0;
for(var i = 0, l = values.length;i < l;i++) {
sum = sum + parseFloat(values[i]);
}
// beginLineX = this.getXCoord(1);
//endLineX = this.getXCoord(7);
beginLineY = this.getYCoord(0.2);
endLineY = this.getYCoord(1.2);
isc.DrawLine.create({
drawPane: this,
startPoint: [this.getChartLeft() , beginLineY ],
endPoint : [this.getChartLeft() + this.getChartWidth(), endLineY ],
autoDraw: true
}, {
lineWidth: 4,
lineColor: "red",
linePattern: "dash"
});
},
valueProperty:"value",
facets: [
{ id:"metric",
inlinedValues:true,
values:[{id:"value"}, {id:"Time"}]
},
{ id:"animal" }
],
data: [
{
"Time":0.033,
"value":0.02
,animal:"Moose"
},
{
"Time":0.083,
"value":0.15
,animal:"Moose"
},
{
"Time":0.25,
"value":0.77
,animal:"Moose"
},
{
"Time":0.5,
"value":0.87
,animal:"Moose"
},
{
"Time":1,
"value":1.15
,animal:"Moose"
},
{
"Time":2,
"value":1.15
,animal:"Moose"
},
{
"Time":4,
"value":0.71
,animal:"Moose"
},
{
"Time":5,
"value":0.67
,animal:"Moose"
},
{
"Time":6,
"value":0.61
,animal:"Moose"
},
{
"Time":7,
"value":0.41
,animal:"Moose"
},
{
"Time":8,
"value":0.22
,animal:"Moose"
},
{
"Time":0.033,
"value":0.02
,animal:"Platypus"
},
{
"Time":0.083,
"value":0.28
,animal:"Platypus"
},
{
"Time":0.25,
"value":0.71
,animal:"Platypus"
},
{
"Time":0.5,
"value":0.81
,animal:"Platypus"
},
{
"Time":1,
"value":1.06
,animal:"Platypus"
},
{
"Time":2,
"value":1.06
,animal:"Platypus"
},
{
"Time":4,
"value":0.52
,animal:"Platypus"
},
{
"Time":8,
"value":0.10
,animal:"Platypus"
}
]
});
Comment