@ -1,14 +1,10 @@
var Emitter = require ( 'emitter-component' ) ;
var Emitter = require ( 'emitter-component' ) ;
var DataSet = require ( '../DataSet' ) ;
var DataView = require ( '../DataView' ) ;
var util = require ( '../util' ) ;
var util = require ( '../util' ) ;
var Point3d = require ( './Point3d' ) ;
var Point3d = require ( './Point3d' ) ;
var Point2d = require ( './Point2d' ) ;
var Point2d = require ( './Point2d' ) ;
var Camera = require ( './Camera' ) ;
var Filter = require ( './Filter' ) ;
var Filter = require ( './Filter' ) ;
var Slider = require ( './Slider' ) ;
var Slider = require ( './Slider' ) ;
var StepNumber = require ( './StepNumber' ) ;
var StepNumber = require ( './StepNumber' ) ;
var Range = require ( './Range' ) ;
var Settings = require ( './Settings' ) ;
var Settings = require ( './Settings' ) ;
var DataGroup = require ( './DataGroup' ) ;
var DataGroup = require ( './DataGroup' ) ;
@ -439,7 +435,7 @@ Graph3d.prototype.getDataPoints = function(data) {
Graph3d . prototype . _getDataPoints = function ( data ) {
Graph3d . prototype . _getDataPoints = function ( data ) {
// TODO: store the created matrix dataPoints in the filters instead of
// TODO: store the created matrix dataPoints in the filters instead of
// reloading each time.
// reloading each time.
var x , y , i , z , obj , point ;
var x , y , i , obj ;
var dataPoints = [ ] ;
var dataPoints = [ ] ;
@ -492,7 +488,7 @@ Graph3d.prototype._getDataPoints = function (data) {
// Add next member points for line drawing
// Add next member points for line drawing
for ( i = 0 ; i < dataPoints . length ; i ++ ) {
for ( i = 0 ; i < dataPoints . length ; i ++ ) {
if ( i > 0 ) {
if ( i > 0 ) {
dataPoints [ i - 1 ] . pointNext = dataPoints [ i ] ; ;
dataPoints [ i - 1 ] . pointNext = dataPoints [ i ] ;
}
}
}
}
}
}
@ -692,8 +688,6 @@ Graph3d.prototype.setData = function (data) {
* @ param { Object } options
* @ param { Object } options
* /
* /
Graph3d . prototype . setOptions = function ( options ) {
Graph3d . prototype . setOptions = function ( options ) {
var cameraPosition = undefined ;
this . animationStop ( ) ;
this . animationStop ( ) ;
Settings . setOptions ( options , this ) ;
Settings . setOptions ( options , this ) ;
@ -913,7 +907,6 @@ Graph3d.prototype._redrawLegend = function() {
var step = new StepNumber ( legendMin , legendMax , ( legendMax - legendMin ) / 5 , true ) ;
var step = new StepNumber ( legendMin , legendMax , ( legendMax - legendMin ) / 5 , true ) ;
step . start ( true ) ;
step . start ( true ) ;
var y ;
var from ;
var from ;
var to ;
var to ;
while ( ! step . end ( ) ) {
while ( ! step . end ( ) ) {
@ -1125,6 +1118,7 @@ Graph3d.prototype._redrawAxis = function() {
var xRange = this . xRange ;
var xRange = this . xRange ;
var yRange = this . yRange ;
var yRange = this . yRange ;
var zRange = this . zRange ;
var zRange = this . zRange ;
var point3d ;
// draw x-grid lines
// draw x-grid lines
ctx . lineWidth = 1 ;
ctx . lineWidth = 1 ;
@ -1152,8 +1146,8 @@ Graph3d.prototype._redrawAxis = function() {
if ( this . showXAxis ) {
if ( this . showXAxis ) {
yText = ( armVector . x > 0 ) ? yRange . min : yRange . max ;
yText = ( armVector . x > 0 ) ? yRange . min : yRange . max ;
var point3d = new Point3d ( x , yText , zRange . min ) ;
var msg = ' ' + this . xValueLabel ( x ) + ' ' ;
point3d = new Point3d ( x , yText , zRange . min ) ;
let msg = ' ' + this . xValueLabel ( x ) + ' ' ;
this . drawAxisLabelX ( ctx , point3d , msg , armAngle , textMargin ) ;
this . drawAxisLabelX ( ctx , point3d , msg , armAngle , textMargin ) ;
}
}
@ -1187,7 +1181,7 @@ Graph3d.prototype._redrawAxis = function() {
if ( this . showYAxis ) {
if ( this . showYAxis ) {
xText = ( armVector . y > 0 ) ? xRange . min : xRange . max ;
xText = ( armVector . y > 0 ) ? xRange . min : xRange . max ;
point3d = new Point3d ( xText , y , zRange . min ) ;
point3d = new Point3d ( xText , y , zRange . min ) ;
var msg = ' ' + this . yValueLabel ( y ) + ' ' ;
let msg = ' ' + this . yValueLabel ( y ) + ' ' ;
this . drawAxisLabelY ( ctx , point3d , msg , armAngle , textMargin ) ;
this . drawAxisLabelY ( ctx , point3d , msg , armAngle , textMargin ) ;
}
}
@ -1213,7 +1207,7 @@ Graph3d.prototype._redrawAxis = function() {
to = new Point2d ( from2d . x - textMargin , from2d . y ) ;
to = new Point2d ( from2d . x - textMargin , from2d . y ) ;
this . _line ( ctx , from2d , to , this . axisColor ) ;
this . _line ( ctx , from2d , to , this . axisColor ) ;
var msg = this . zValueLabel ( z ) + ' ' ;
let msg = this . zValueLabel ( z ) + ' ' ;
this . drawAxisLabelZ ( ctx , from3d , msg , 5 ) ;
this . drawAxisLabelZ ( ctx , from3d , msg , 5 ) ;
step . next ( ) ;
step . next ( ) ;
@ -1339,7 +1333,7 @@ Graph3d.prototype._getStrokeWidth = function(point) {
* Draw a bar element in the view with the given properties .
* Draw a bar element in the view with the given properties .
* /
* /
Graph3d . prototype . _redrawBar = function ( ctx , point , xWidth , yWidth , color , borderColor ) {
Graph3d . prototype . _redrawBar = function ( ctx , point , xWidth , yWidth , color , borderColor ) {
var i , j , surface ;
var surface ;
// calculate all corner points
// calculate all corner points
var me = this ;
var me = this ;
@ -1377,7 +1371,7 @@ Graph3d.prototype._redrawBar = function(ctx, point, xWidth, yWidth, color, borde
point . surfaces = surfaces ;
point . surfaces = surfaces ;
// calculate the distance of each of the surface centers to the camera
// calculate the distance of each of the surface centers to the camera
for ( j = 0 ; j < surfaces . length ; j ++ ) {
for ( let j = 0 ; j < surfaces . length ; j ++ ) {
surface = surfaces [ j ] ;
surface = surfaces [ j ] ;
var transCenter = this . _convertPointToTranslation ( surface . center ) ;
var transCenter = this . _convertPointToTranslation ( surface . center ) ;
surface . dist = this . showPerspective ? transCenter . length ( ) : - transCenter . z ;
surface . dist = this . showPerspective ? transCenter . length ( ) : - transCenter . z ;
@ -1404,7 +1398,7 @@ Graph3d.prototype._redrawBar = function(ctx, point, xWidth, yWidth, color, borde
ctx . strokeStyle = borderColor ;
ctx . strokeStyle = borderColor ;
ctx . fillStyle = color ;
ctx . fillStyle = color ;
// NOTE: we start at j=2 instead of j=0 as we don't need to draw the two surfaces at the backside
// NOTE: we start at j=2 instead of j=0 as we don't need to draw the two surfaces at the backside
for ( j = 2 ; j < surfaces . length ; j ++ ) {
for ( let j = 2 ; j < surfaces . length ; j ++ ) {
surface = surfaces [ j ] ;
surface = surfaces [ j ] ;
this . _polygon ( ctx , surface . corners ) ;
this . _polygon ( ctx , surface . corners ) ;
}
}
@ -1652,7 +1646,6 @@ Graph3d.prototype._redrawSurfaceGraphPoint = function(ctx, point) {
var topSideVisible = true ;
var topSideVisible = true ;
var fillStyle ;
var fillStyle ;
var strokeStyle ;
var strokeStyle ;
var lineWidth ;
if ( this . showGrayBottom || this . showShadow ) {
if ( this . showGrayBottom || this . showShadow ) {
// calculate the cross product of the two vectors from center
// calculate the cross product of the two vectors from center