1/*! angularjs-nvd3-directives - v0.0.8 - 2015-02-04 2 * http://angularjs-nvd3-directives.github.io/angularjs-nvd3-directives 3 * Copyright (c) 2015 Christian Maurer; Licensed Apache License, v2.0 */ 4( function () { 5 'use strict'; 6 7 8 angular.module( 'legendDirectives', [] ).directive( 'simpleSvgLegend', function () { 9 return { 10 restrict: 'EA', 11 scope: { 12 id: '@', 13 width: '@', 14 height: '@', 15 margin: '@', 16 x: '@', 17 y: '@', 18 labels: '@', 19 styles: '@', 20 classes: '@', 21 shapes: '@', 22 padding: '@', 23 columns: '@' 24 }, 25 compile: function () { 26 return function link( scope, element, attrs ) { 27 var id, width, height, margin, widthTracker = 0, 28 heightTracker = 0, 29 columns = 1, 30 columnTracker = 0, 31 padding = 10, 32 paddingStr, svgNamespace = 'http://www.w3.org/2000/svg', 33 svg, g, labels, styles, classes, shapes, x = 0, 34 y = 0; 35 margin = scope.$eval( attrs.margin ) || { 36 left: 5, 37 top: 5, 38 bottom: 5, 39 right: 5 40 }; 41 width = attrs.width === 'undefined' ? element[ 0 ].parentElement.offsetWidth - ( margin.left + margin.right ) : +attrs.width - ( margin.left + margin.right ); 42 height = attrs.height === 'undefined' ? element[ 0 ].parentElement.offsetHeight - ( margin.top + margin.bottom ) : +attrs.height - ( margin.top + margin.bottom ); 43 if ( !attrs.id ) { 44 //if an id is not supplied, create a random id. 45 id = 'legend-' + Math.random(); 46 } else { 47 id = attrs.id; 48 } 49 if ( attrs.columns ) { 50 columns = +attrs.columns; 51 } 52 if ( attrs.padding ) { 53 padding = +attrs.padding; 54 } 55 paddingStr = padding + ''; 56 svg = document.createElementNS( svgNamespace, 'svg' ); 57 if ( attrs.width ) { 58 svg.setAttribute( 'width', width + '' ); 59 } 60 if ( attrs.height ) { 61 svg.setAttribute( 'height', height + '' ); 62 } 63 svg.setAttribute( 'id', id ); 64 if ( attrs.x ) { 65 x = +attrs.x; 66 } 67 if ( attrs.y ) { 68 y = +attrs.y; 69 } 70 element.append( svg ); 71 g = document.createElementNS( svgNamespace, 'g' ); 72 g.setAttribute( 'transform', 'translate(' + x + ',' + y + ')' ); 73 svg.appendChild( g ); 74 if ( attrs.labels ) { 75 labels = scope.$eval( attrs.labels ); 76 } 77 if ( attrs.styles ) { 78 styles = scope.$eval( attrs.styles ); 79 } 80 if ( attrs.classes ) { 81 classes = scope.$eval( attrs.classes ); 82 } 83 if ( attrs.shapes ) { 84 shapes = scope.$eval( attrs.shapes ); 85 } 86 for ( var i in labels ) { 87 if ( labels.hasOwnProperty( i ) ) { 88 var shpe = shapes[ i ], 89 shape, text, textSize, g1; 90 if ( columnTracker % columns === 0 ) { 91 widthTracker = 0;
92 heightTracker = heightTracker + ( padding + padding * 1.5 ); 93 } 94 g1 = document.createElementNS( svgNamespace, 'g' ); 95 g1.setAttribute( 'transform', 'translate(' + widthTracker + ', ' + heightTracker + ')' ); 96 if ( shpe === 'rect' ) { 97 shape = document.createElementNS( svgNamespace, 'rect' ); 98 //x, y, rx, ry 99 shape.setAttribute( 'y', 0 - padding / 2 + '' ); 100 shape.setAttribute( 'width', paddingStr ); 101 shape.setAttribute( 'height', paddingStr ); 102 } else if ( shpe === 'ellipse' ) { 103 shape = document.createElementNS( svgNamespace, 'ellipse' ); 104 shape.setAttribute( 'rx', paddingStr ); 105 shape.setAttribute( 'ry', padding + padding / 2 + '' ); 106 } else { 107 shape = document.createElementNS( svgNamespace, 'circle' ); 108 shape.setAttribute( 'r', padding / 2 + '' ); 109 } 110 if ( styles && styles[ i ] ) { 111 shape.setAttribute( 'style', styles[ i ] ); 112 } 113 if ( classes && classes[ i ] ) { 114 shape.setAttribute( 'class', classes[ i ] ); 115 } 116 g1.appendChild( shape ); 117 widthTracker = widthTracker + shape.clientWidth + ( padding + padding / 2 ); 118 text = document.createElementNS( svgNamespace, 'text' ); 119 text.setAttribute( 'transform', 'translate(10, 5)' ); 120 text.appendChild( document.createTextNode( labels[ i ] ) ); 121 g1.appendChild( text ); 122 g.appendChild( g1 ); 123 textSize = text.clientWidth; 124 widthTracker = widthTracker + textSize + ( padding + padding * 0.75 ); 125 columnTracker++; 126 } 127 } 128 }; 129 } 130 }; 131 } ).directive( 'nvd3Legend', [ function () { 132 var margin, width, height, id; 133 return { 134 restrict: 'EA', 135 scope: { 136 data: '=', 137 id: '@', 138 margin: '&', 139 width: '@', 140 height: '@', 141 key: '&', 142 color: '&', 143 align: '@', 144 rightalign: '@', 145 updatestate: '@', 146 radiobuttonmode: '@', 147 x: '&', 148 y: '&' 149 }, 150 link: function ( scope, element, attrs ) { 151 scope.$watch( 'data', function ( data ) { 152 if ( data ) { 153 if ( scope.chart ) { 154 return d3.select( '#' + attrs.id + ' svg' ).attr( 'height', height ).attr( 'width', width ).datum( data ).transition().duration( 250 ).call( scope.chart ); 155 } 156 margin = scope.$eval( attrs.margin ) || { 157 top: 5, 158 right: 0, 159 bottom: 5, 160 left: 0 161 }; 162 width = attrs.width === undefined ? element[ 0 ].parentElement.offsetWidth - ( margin.left + margin.right ) : +attrs.width - ( margin.left + margin.right ); 163 height = attrs.height === undefined ? element[ 0 ].parentElement.offsetHeight - ( margin.top + margin.bottom ) : +attrs.height - ( margin.top + margin.bottom ); 164 if ( width === undefined || width < 0 ) { 165 width = 400; 166 } 167 if ( height === undefined || height < 0 ) { 168 height = 20; 169 } 170 if ( !attrs.id ) { 171 //if an id is not supplied, create a random id. 172 id = 'legend-' + Math.random(); 173 } else { 174 id = attrs.id; 175 } 176 nv.addGraph( { 177 generate: function () { 178 var chart = nv.models.legend().width( width ).height( height ).margin( margin ).align( attrs.align === undefined ? true : attrs.align === 'true' ).rightAlign( attrs.rightalign === undefined ? true : attrs.rightalign === 'true' ).updateState( attrs.updatestate === undefined ? true : attrs.updatestate === 'true' ).radioButtonMode( attrs.radiobuttonmode === undefined ? false : attrs.radiobuttonmode === 'true' ).color( attrs.color === undefined ? nv.utils.defaultColor() : scope.color() ).key( attrs.key === undefined ? function ( d ) { 179 return d.key; 180 } : scope.key() ); 181 if ( !d3.select( '#' + attrs.id + ' svg' )[ 0 ][ 0 ] ) { 182 d3.select( '#' + attrs.id ).append( 'svg' ); 183 } 184 d3.select( '#' + attrs.id + ' svg' ).attr( 'height', height ).attr( 'width', width ).datum( data ).transition().duration( 250 ).call( chart ); 185 nv.utils.windowResize( chart.update ); 186 scope.chart = chart; 187 return chart; 188 } 189 } ); 190 } 191 } ); 192 } 193 }; 194 } ] ); 195 196 function initializeLegendMargin( scope, attrs ) { 197 var margin = ( scope.$eval( attrs.legendmargin ) || { 198 left: 0, 199 top: 5,
200 bottom: 5, 201 right: 0 202 } ); 203 if ( typeof ( margin ) !== 'object' ) { 204 // we were passed a vanilla int, convert to full margin object 205 margin = { 206 left: margin, 207 top: margin, 208 bottom: margin, 209 right: margin 210 }; 211 } 212 scope.legendmargin = margin; 213 } 214 215 function configureLegend( chart, scope, attrs ) { 216 if ( chart.legend && attrs.showlegend && ( attrs.showlegend === 'true' ) ) { 217 initializeLegendMargin( scope, attrs ); 218 chart.legend.margin( scope.legendmargin ); 219 chart.legend.width( attrs.legendwidth === undefined ? 400 : ( +attrs.legendwidth ) ); 220 chart.legend.height( attrs.legendheight === undefined ? 20 : ( +attrs.legendheight ) ); 221 chart.legend.key( attrs.legendkey === undefined ? function ( d ) { 222 return d.key; 223 } : scope.legendkey() ); 224 chart.legend.color( attrs.legendcolor === undefined ? nv.utils.defaultColor() : scope.legendcolor() ); 225 chart.legend.align( attrs.legendalign === undefined ? true : ( attrs.legendalign === 'true' ) ); 226 chart.legend.rightAlign( attrs.legendrightalign === undefined ? true : ( attrs.legendrightalign === 'true' ) ); 227 chart.legend.updateState( attrs.legendupdatestate === undefined ? true : ( attrs.legendupdatestate === 'true' ) ); 228 chart.legend.radioButtonMode( attrs.legendradiobuttonmode === undefined ? false : ( attrs.legendradiobuttonmode === 'true' ) ); 229 } 230 } 231 232 function processEvents( chart, scope ) { 233 if ( chart.dispatch ) { 234 if ( chart.dispatch.tooltipShow ) { 235 chart.dispatch.on( 'tooltipShow.directive', function ( event ) { 236 scope.$emit( 'tooltipShow.directive', event ); 237 } ); 238 } 239 240 if ( chart.dispatch.tooltipHide ) { 241 chart.dispatch.on( 'tooltipHide.directive', function ( event ) { 242 scope.$emit( 'tooltipHide.directive', event ); 243 } ); 244 } 245 246 if ( chart.dispatch.beforeUpdate ) { 247 chart.dispatch.on( 'beforeUpdate.directive', function ( event ) { 248 scope.$emit( 'beforeUpdate.directive', event ); 249 } ); 250 } 251 252 if ( chart.dispatch.stateChange ) { 253 chart.dispatch.on( 'stateChange.directive', function ( event ) { 254 scope.$emit( 'stateChange.directive', event ); 255 } ); 256 } 257 258 if ( chart.dispatch.changeState ) { 259 chart.dispatch.on( 'changeState.directive', function ( event ) { 260 scope.$emit( 'changeState.directive', event ); 261 } ); 262 } 263 } 264 265 if ( chart.lines ) { 266 chart.lines.dispatch.on( 'elementMouseover.tooltip.directive', function ( event ) { 267 scope.$emit( 'elementMouseover.tooltip.directive', event ); 268 } ); 269 270 chart.lines.dispatch.on( 'elementMouseout.tooltip.directive', function ( event ) { 271 scope.$emit( 'elementMouseout.tooltip.directive', event ); 272 } ); 273 274 chart.lines.dispatch.on( 'elementClick.directive', function ( event ) { 275 scope.$emit( 'elementClick.directive', event ); 276 } ); 277 } 278 279 if ( chart.stacked && chart.stacked.dispatch ) { 280 chart.stacked.dispatch.on( 'areaClick.toggle.directive', function ( event ) {
281 scope.$emit( 'areaClick.toggle.directive', event ); 282 } ); 283 284 chart.stacked.dispatch.on( 'tooltipShow.directive', function ( event ) { 285 scope.$emit( 'tooltipShow.directive', event ); 286 } ); 287 288 chart.stacked.dispatch.on( 'tooltipHide.directive', function ( event ) { 289 scope.$emit( 'tooltipHide.directive', event ); 290 } ); 291 292 } 293 294 if ( chart.interactiveLayer ) { 295 if ( chart.interactiveLayer.elementMouseout ) { 296 chart.interactiveLayer.dispatch.on( 'elementMouseout.directive', function ( event ) { 297 scope.$emit( 'elementMouseout.directive', event ); 298 } ); 299 } 300 301 if ( chart.interactiveLayer.elementMousemove ) { 302 chart.interactiveLayer.dispatch.on( 'elementMousemove.directive', function ( event ) { 303 scope.$emit( 'elementMousemove.directive', event ); 304 } ); 305 } 306 } 307 308 if ( chart.discretebar ) { 309 chart.discretebar.dispatch.on( 'elementMouseover.tooltip.directive', function ( event ) { 310 scope.$emit( 'elementMouseover.tooltip.directive', event ); 311 } ); 312 313 chart.discretebar.dispatch.on( 'elementMouseout.tooltip.directive', function ( event ) { 314 scope.$emit( 'elementMouseout.tooltip.directive', event ); 315 } ); 316 317 chart.discretebar.dispatch.on( 'elementClick.directive', function ( event ) { 318 scope.$emit( 'elementClick.directive', event ); 319 } ); 320 } 321 322 if ( chart.multibar ) { 323 chart.multibar.dispatch.on( 'elementMouseover.tooltip.directive', function ( event ) { 324 scope.$emit( 'elementMouseover.tooltip.directive', event ); 325 } ); 326 327 chart.multibar.dispatch.on( 'elementMouseout.tooltip.directive', function ( event ) { 328 scope.$emit( 'elementMouseout.tooltip.directive', event ); 329 } ); 330 331 chart.multibar.dispatch.on( 'elementClick.directive', function ( event ) { 332 scope.$emit( 'elementClick.directive', event ); 333 } ); 334 335 } 336 337 if ( chart.pie ) { 338 chart.pie.dispatch.on( 'elementMouseover.tooltip.directive', function ( event ) { 339 scope.$emit( 'elementMouseover.tooltip.directive', event ); 340 } ); 341 342 chart.pie.dispatch.on( 'elementMouseout.tooltip.directive', function ( event ) { 343 scope.$emit( 'elementMouseout.tooltip.directive', event ); 344 } ); 345 346 chart.pie.dispatch.on( 'elementClick.directive', function ( event ) { 347 scope.$emit( 'elementClick.directive', event ); 348 } ); 349 } 350 351 if ( chart.scatter ) { 352 chart.scatter.dispatch.on( 'elementMouseover.tooltip.directive', function ( event ) { 353 scope.$emit( 'elementMouseover.tooltip.directive', event ); 354 } ); 355 356 chart.scatter.dispatch.on( 'elementMouseout.tooltip.directive', function ( event ) { 357 scope.$emit( 'elementMouseout.tooltip.directive', event ); 358 } ); 359 } 360 361 if ( chart.bullet ) { 362 chart.bullet.dispatch.on( 'elementMouseover.tooltip.directive', function ( event ) { 363 scope.$emit( 'elementMouseover.tooltip.directive', event ); 364 } ); 365 366 chart.bullet.dispatch.on( 'elementMouseout.tooltip.directive', function ( event ) { 367 scope.$emit( 'elementMouseout.tooltip.directive', event ); 368 } ); 369 } 370 371 if ( chart.legend ) { 372 //'legendClick', 'legendDblclick', 'legendMouseover' 373 //stateChange 374 chart.legend.dispatch.on( 'stateChange.legend.directive', function ( event ) { 375 scope.$emit( 'stateChange.legend.directive', event ); 376 } ); 377 chart.legend.dispatch.on( 'legendClick.directive', function ( d, i ) { 378 scope.$emit( 'legendClick.directive', d, i ); 379 } ); 380 chart.legend.dispatch.on( 'legendDblclick.directive', function ( d, i ) { 381 scope.$emit( 'legendDblclick.directive', d, i ); 382 } ); 383 chart.legend.dispatch.on( 'legendMouseover.directive', function ( d, i ) { 384 scope.$emit( 'legendMouseover.directive', d, i ); 385 } ); 386 } 387 388 if ( chart.controls ) { 389 if ( chart.controls.legendClick ) { 390 chart.controls.dispatch.on( 'legendClick.directive', function ( d, i ) { 391 scope.$emit( 'legendClick.directive', d, i ); 392 } ); 393 } 394 } 395 396 } 397 398 function configureXaxis( chart, scope, attrs ) { 399 if ( attrs.xaxisorient ) { 400 chart.xAxis.orient( attrs.xaxisorient ); 401 } 402 if ( attrs.xaxisticks ) { 403 chart.xAxis.scale().ticks( attrs.xaxisticks ); 404 } 405 if ( attrs.xaxistickvalues ) { 406 if ( Array.isArray( scope.$eval( attrs.xaxistickvalues ) ) ) { 407 chart.xAxis.tickValues( scope.$eval( attrs.xaxistickvalues ) ); 408 } else if ( typeof scope.xaxistickvalues() === 'function' ) { 409 chart.xAxis.tickValues( scope.xaxistickvalues() ); 410 } 411 } 412 if ( attrs.xaxisticksubdivide ) { 413 chart.xAxis.tickSubdivide( scope.xaxisticksubdivide() ); 414 } 415 if ( attrs.xaxisticksize ) { 416 chart.xAxis.tickSize( scope.xaxisticksize() ); 417 } 418 if ( attrs.xaxistickpadding ) { 419 chart.xAxis.tickPadding( scope.xaxistickpadding() ); 420 } 421 if ( attrs.xaxistickformat ) { 422 chart.xAxis.tickFormat( scope.xaxistickformat() ); 423 } 424 if ( attrs.xaxislabel ) { 425 chart.xAxis.axisLabel( attrs.xaxislabel ); 426 } 427 if ( attrs.xaxisscale ) { 428 chart.xAxis.scale( scope.xaxisscale() ); 429 } 430 if ( attrs.xaxisdomain ) { 431 if ( Array.isArray( scope.$eval( attrs.xaxisdomain ) ) ) { 432 chart.xDomain( scope.$eval( attrs.xaxisdomain ) ); 433 } else if ( typeof scope.xaxisdomain() === 'function' ) { 434 chart.xDomain( scope.xaxisdomain() ); 435 } 436 } 437 if ( attrs.xaxisrange ) { 438 if ( Array.isArray( scope.$eval( attrs.xaxisrange ) ) ) { 439 chart.xRange( scope.$eval( attrs.xaxisrange ) ); 440 } else if ( typeof scope.xaxisrange() === 'function' ) { 441 chart.xRange( scope.xaxisrange() ); 442 } 443 } 444 if ( attrs.xaxisrangeband ) { 445 chart.xAxis.rangeBand( scope.xaxisrangeband() ); 446 } 447 if ( attrs.xaxisrangebands ) { 448 chart.xAxis.rangeBands( scope.xaxisrangebands() ); 449 } 450 if ( attrs.xaxisshowmaxmin ) { 451 chart.xAxis.showMaxMin( ( attrs.xaxisshowmaxmin === 'true' ) ); 452 } 453 if ( attrs.xaxishighlightzero ) { 454 chart.xAxis.highlightZero( ( attrs.xaxishighlightzero === 'true' ) ); 455 } 456 if ( attrs.xaxisrotatelabels ) { 457 chart.xAxis.rotateLabels( ( +attrs.xaxisrotatelabels ) ); 458 } 459 // if(attrs.xaxisrotateylabel){ 460 // chart.xAxis.rotateYLabel((attrs.xaxisrotateylabel === "true")); 461 // } 462 if ( attrs.xaxisstaggerlabels ) { 463 chart.xAxis.staggerLabels( ( attrs.xaxisstaggerlabels === 'true' ) ); 464 } 465 if ( attrs.xaxislabeldistance ) { 466 chart.xAxis.axisLabelDistance( ( +attrs.xaxislabeldistance ) ); 467 } 468 } 469 470 function configureX2axis( chart, scope, attrs ) { 471 if ( attrs.x2axisorient ) { 472 chart.x2Axis.orient( attrs.x2axisorient ); 473 } 474 if ( attrs.x2axisticks ) { 475 chart.x2Axis.scale().ticks( attrs.x2axisticks ); 476 } 477 if ( attrs.x2axistickvalues ) { 478 if ( Array.isArray( scope.$eval( attrs.x2axistickvalues ) ) ) { 479 chart.x2Axis.tickValues( scope.$eval( attrs.x2axistickvalues ) ); 480 } else if ( typeof scope.xaxistickvalues() === 'function' ) { 481 chart.x2Axis.tickValues( scope.x2axistickvalues() ); 482 } 483 } 484 if ( attrs.x2axisticksubdivide ) { 485 chart.x2Axis.tickSubdivide( scope.x2axisticksubdivide() ); 486 } 487 if ( attrs.x2axisticksize ) { 488 chart.x2Axis.tickSize( scope.x2axisticksize() ); 489 } 490 if ( attrs.x2axistickpadding ) { 491 chart.x2Axis.tickPadding( scope.x2axistickpadding() ); 492 } 493 if ( attrs.x2axistickformat ) { 494 chart.x2Axis.tickFormat( scope.x2axistickformat() ); 495 } 496 if ( attrs.x2axislabel ) { 497 chart.x2Axis.axisLabel( attrs.x2axislabel ); 498 } 499 if ( attrs.x2axisscale ) { 500 chart.x2Axis.scale( scope.x2axisscale() ); 501 } 502 if ( attrs.x2axisdomain ) { 503 if ( Array.isArray( scope.$eval( attrs.x2axisdomain ) ) ) { 504 chart.x2Axis.domain( scope.$eval( attrs.x2axisdomain ) ); 505 } else if ( typeof scope.x2axisdomain() === 'function' ) { 506 chart.x2Axis.domain( scope.x2axisdomain() ); 507 } 508 } 509 if ( attrs.x2axisrange ) { 510 if ( Array.isArray( scope.$eval( attrs.x2axisrange ) ) ) { 511 chart.x2Axis.range( scope.$eval( attrs.x2axisrange ) ); 512 } else if ( typeof scope.x2axisrange() === 'function' ) { 513 chart.x2Axis.range( scope.x2axisrange() ); 514 } 515 } 516 if ( attrs.x2axisrangeband ) { 517 chart.x2Axis.rangeBand( scope.x2axisrangeband() ); 518 } 519 if ( attrs.x2axisrangebands ) { 520 chart.x2Axis.rangeBands( scope.x2axisrangebands() ); 521 } 522 if ( attrs.x2axisshowmaxmin ) { 523 chart.x2Axis.showMaxMin( ( attrs.x2axisshowmaxmin === 'true' ) ); 524 } 525 if ( attrs.x2axishighlightzero ) { 526 chart.x2Axis.highlightZero( ( attrs.x2axishighlightzero === 'true' ) ); 527 } 528 if ( attrs.x2axisrotatelables ) { 529 chart.x2Axis.rotateLabels( ( +attrs.x2axisrotatelables ) ); 530 } 531 // if(attrs.xaxisrotateylabel){ 532 // chart.xAxis.rotateYLabel((attrs.xaxisrotateylabel === "true")); 533 // } 534 if ( attrs.x2axisstaggerlabels ) { 535 chart.x2Axis.staggerLabels( ( attrs.x2axisstaggerlabels === 'true' ) ); 536 } 537 if ( attrs.x2axislabeldistance ) { 538 chart.x2Axis.axisLabelDistance( ( +attrs.x2axislabeldistance ) ); 539 } 540 } 541 542 function configureYaxis( chart, scope, attrs ) { 543 if ( attrs.yaxisorient ) { 544 chart.yAxis.orient( attrs.yaxisorient ); 545 } 546 if ( attrs.yaxisticks ) { 547 chart.yAxis.scale().ticks( attrs.yaxisticks ); 548 } 549 if ( attrs.yaxistickvalues ) { 550 if ( Array.isArray( scope.$eval( attrs.yaxistickvalues ) ) ) { 551 chart.yAxis.tickValues( scope.$eval( attrs.yaxistickvalues ) ); 552 } else if ( typeof scope.yaxistickvalues() === 'function' ) { 553 chart.yAxis.tickValues( scope.yaxistickvalues() ); 554 } 555 } 556 if ( attrs.yaxisticksubdivide ) { 557 chart.yAxis.tickSubdivide( scope.yaxisticksubdivide() ); 558 } 559 if ( attrs.yaxisticksize ) { 560 chart.yAxis.tickSize( scope.yaxisticksize() ); 561 } 562 if ( attrs.yaxistickpadding ) { 563 chart.yAxis.tickPadding( scope.yaxistickpadding() ); 564 } 565 if ( attrs.yaxistickformat ) { 566 chart.yAxis.tickFormat( scope.yaxistickformat() ); 567 } 568 if ( attrs.yaxislabel ) { 569 chart.yAxis.axisLabel( attrs.yaxislabel ); 570 } 571 if ( attrs.yaxisscale ) { 572 chart.yAxis.scale( scope.yaxisscale() ); 573 } 574 if ( attrs.yaxisdomain ) { 575 if ( Array.isArray( scope.$eval( attrs.yaxisdomain ) ) ) { 576 chart.yDomain( scope.$eval( attrs.yaxisdomain ) ); 577 } else if ( typeof scope.yaxisdomain() === 'function' ) { 578 chart.yDomain( scope.yaxisdomain() ); 579 } 580 } 581 if ( attrs.yaxisrange ) { 582 if ( Array.isArray( scope.$eval( attrs.yaxisrange ) ) ) { 583 chart.yRange( scope.$eval( attrs.yaxisrange ) ); 584 } else if ( typeof scope.yaxisrange() === 'function' ) { 585 chart.yRange( scope.yaxisrange() ); 586 } 587 } 588 if ( attrs.yaxisrangeband ) { 589 chart.yAxis.rangeBand( scope.yaxisrangeband() ); 590 } 591 if ( attrs.yaxisrangebands ) { 592 chart.yAxis.rangeBands( scope.yaxisrangebands() ); 593 } 594 if ( attrs.yaxisshowmaxmin ) { 595 chart.yAxis.showMaxMin( ( attrs.yaxisshowmaxmin === 'true' ) ); 596 } 597 if ( attrs.yaxishighlightzero ) { 598 chart.yAxis.highlightZero( ( attrs.yaxishighlightzero === 'true' ) ); 599 } 600 if ( attrs.yaxisrotatelabels ) { 601 chart.yAxis.rotateLabels( ( +attrs.yaxisrotatelabels ) ); 602 } 603 if ( attrs.yaxisrotateylabel ) { 604 chart.yAxis.rotateYLabel( ( attrs.yaxisrotateylabel === 'true' ) ); 605 } 606 if ( attrs.yaxisstaggerlabels ) { 607 chart.yAxis.staggerLabels( ( attrs.yaxisstaggerlabels === 'true' ) ); 608 } 609 if ( attrs.yaxislabeldistance ) { 610 chart.yAxis.axisLabelDistance( ( +attrs.yaxislabeldistance ) ); 611 } 612 } 613 614 function configureY1axis( chart, scope, attrs ) { 615 if ( attrs.y1axisticks ) { 616 chart.y1Axis.scale().ticks( attrs.y1axisticks ); 617 } 618 if ( attrs.y1axistickvalues ) { 619 if ( Array.isArray( scope.$eval( attrs.y1axistickvalues ) ) ) { 620 chart.y1Axis.tickValues( scope.$eval( attrs.y1axistickvalues ) ); 621 } else if ( typeof scope.y1axistickvalues() === 'function' ) { 622 chart.y1Axis.tickValues( scope.y1axistickvalues() ); 623 } 624 } 625 if ( attrs.y1axisticksubdivide ) { 626 chart.y1Axis.tickSubdivide( scope.y1axisticksubdivide() ); 627 } 628 if ( attrs.y1axisticksize ) { 629 chart.y1Axis.tickSize( scope.y1axisticksize() ); 630 } 631 if ( attrs.y1axistickpadding ) { 632 chart.y1Axis.tickPadding( scope.y1axistickpadding() ); 633 } 634 if ( attrs.y1axistickformat ) { 635 chart.y1Axis.tickFormat( scope.y1axistickformat() ); 636 } 637 if ( attrs.y1axislabel ) { 638 chart.y1Axis.axisLabel( attrs.y1axislabel ); 639 } 640 if ( attrs.y1axisscale ) { 641 chart.y1Axis.yScale( scope.y1axisscale() ); 642 } 643 if ( attrs.y1axisdomain ) { 644 if ( Array.isArray( scope.$eval( attrs.y1axisdomain ) ) ) { 645 chart.y1Axis.domain( scope.$eval( attrs.y1axisdomain ) ); 646 } else if ( typeof scope.y1axisdomain() === 'function' ) { 647 chart.y1Axis.domain( scope.y1axisdomain() ); 648 } 649 } 650 if ( attrs.y1axisrange ) { 651 if ( Array.isArray( scope.$eval( attrs.y1axisrange ) ) ) { 652 chart.y1Axis.range( scope.$eval( attrs.y1axisrange ) ); 653 } else if ( typeof scope.y1axisrange() === 'function' ) { 654 chart.y1Axis.range( scope.y1axisrange() ); 655 } 656 } 657 if ( attrs.y1axisrangeband ) { 658 chart.y1Axis.rangeBand( scope.y1axisrangeband() ); 659 } 660 if ( attrs.y1axisrangebands ) { 661 chart.y1Axis.rangeBands( scope.y1axisrangebands() ); 662 } 663 if ( attrs.y1axisshowmaxmin ) { 664 chart.y1Axis.showMaxMin( ( attrs.y1axisshowmaxmin === 'true' ) ); 665 } 666 if ( attrs.y1axishighlightzero ) { 667 chart.y1Axis.highlightZero( ( attrs.y1axishighlightzero === 'true' ) ); 668 } 669 if ( attrs.y1axisrotatelabels ) { 670 chart.y1Axis.rotateLabels( ( +scope.y1axisrotatelabels ) ); 671 } 672 if ( attrs.y1axisrotateylabel ) { 673 chart.y1Axis.rotateYLabel( ( attrs.y1axisrotateylabel === 'true' ) ); 674 } 675 if ( attrs.y1axisstaggerlabels ) { 676 chart.y1Axis.staggerlabels( ( attrs.y1axisstaggerlabels === 'true' ) ); 677 } 678 if ( attrs.y1axislabeldistance ) { 679 chart.y1Axis.axisLabelDistance( ( +attrs.y1axislabeldistance ) ); 680 } 681 } 682 683 function configureY2axis( chart, scope, attrs ) { 684 if ( attrs.y2axisticks ) { 685 chart.y2Axis.scale().ticks( attrs.y2axisticks ); 686 } 687 if ( attrs.y2axistickvalues ) { 688 chart.y2Axis.tickValues( scope.$eval( attrs.y2axistickvalues ) ); 689 } 690 if ( attrs.y2axisticksubdivide ) { 691 chart.y2Axis.tickSubdivide( scope.y2axisticksubdivide() ); 692 } 693 if ( attrs.y2axisticksize ) { 694 chart.y2Axis.tickSize( scope.y2axisticksize() ); 695 } 696 if ( attrs.y2axistickpadding ) { 697 chart.y2Axis.tickPadding( scope.y2axistickpadding() ); 698 } 699 if ( attrs.y2axistickformat ) { 700 chart.y2Axis.tickFormat( scope.y2axistickformat() ); 701 } 702 if ( attrs.y2axislabel ) { 703 chart.y2Axis.axisLabel( attrs.y2axislabel ); 704 } 705 if ( attrs.y2axisscale ) { 706 chart.y2Axis.yScale( scope.y2axisscale() ); 707 } 708 if ( attrs.y2axisdomain ) { 709 if ( Array.isArray( scope.$eval( attrs.y2axisdomain ) ) ) { 710 chart.y2Axis.domain( scope.$eval( attrs.y2axisdomain ) ); 711 } else if ( typeof scope.y2axisdomain() === 'function' ) { 712 chart.y2Axis.domain( scope.y2axisdomain() ); 713 } 714 } 715 if ( attrs.y2axisrange ) { 716 if ( Array.isArray( scope.$eval( attrs.y2axisrange ) ) ) { 717 chart.y2Axis.range( scope.$eval( attrs.y2axisrange ) ); 718 } else if ( typeof scope.y2axisrange() === 'function' ) { 719 chart.y2Axis.range( scope.y2axisrange() ); 720 } 721 } 722 if ( attrs.y2axisrangeband ) { 723 chart.y2Axis.rangeBand( scope.y2axisrangeband() ); 724 } 725 if ( attrs.y2axisrangebands ) { 726 chart.y2Axis.rangeBands( scope.y2axisrangebands() ); 727 } 728 if ( attrs.y2axisshowmaxmin ) { 729 chart.y2Axis.showMaxMin( ( attrs.y2axisshowmaxmin === 'true' ) ); 730 } 731 if ( attrs.y2axishighlightzero ) { 732 chart.y2Axis.highlightZero( ( attrs.y2axishighlightzero === 'true' ) ); 733 } 734 if ( attrs.y2axisrotatelabels ) { 735 chart.y2Axis.rotateLabels( ( +sco
735pe.y2axisrotatelabels ) ); 736 } 737 if ( attrs.y2axisrotateylabel ) { 738 chart.y2Axis.rotateYLabel( ( attrs.y2axisrotateylabel === 'true' ) ); 739 } 740 if ( attrs.y2axisstaggerlabels ) { 741 chart.y2Axis.staggerlabels( ( attrs.y2axisstaggerlabels === 'true' ) ); 742 } 743 if ( attrs.y2axislabeldistance ) { 744 chart.y2Axis.axisLabelDistance( ( +attrs.y2axislabeldistance ) ); 745 } 746 } 747 748 function initializeMargin( scope, attrs ) { 749 var margin = scope.$eval( attrs.margin ) || { 750 left: 50, 751 top: 50, 752 bottom: 50, 753 right: 50 754 }; 755 if ( typeof margin !== 'object' ) { 756 // we were passed a vanilla int, convert to full margin object 757 margin = { 758 left: margin, 759 top: margin, 760 bottom: margin, 761 right: margin 762 }; 763 } 764 scope.margin = margin; 765 } 766 767 function getD3Selector( attrs, element ) { 768 if ( !attrs.id ) { 769 //if an id is not supplied, create a random id. 770 var dataAttributeChartID; 771 if ( !attrs[ 'data-chartid' ] ) { 772 dataAttributeChartID = 'chartid' + Math.floor( Math.random() * 1000000001 ); 773 angular.element( element ).attr( 'data-chartid', dataAttributeChartID ); 774 } else { 775 dataAttributeChartID = attrs[ 'data-chartid' ]; 776 } 777 return '[data-chartid=' + dataAttributeChartID + ']'; 778 } else { 779 return '#' + attrs.id; 780 } 781 } 782 783 function checkElementID( scope, attrs, element, chart, data ) { 784 configureXaxis( chart, scope, attrs ); 785 configureX2axis( chart, scope, attrs ); 786 configureYaxis( chart, scope, attrs ); 787 configureY1axis( chart, scope, attrs ); 788 configureY2axis( chart, scope, attrs ); 789 configureLegend( chart, scope, attrs ); 790 processEvents( chart, scope ); 791 var d3Select = getD3Selector( attrs, element ); 792 if ( angular.isArray( data ) && data.length === 0 ) { 793 d3.select( d3Select + ' svg' ).remove(); 794 } 795 if ( d3.select( d3Select + ' svg' ).empty() ) { 796 d3.select( d3Select ).append( 'svg' ); 797 } 798 d3.select( d3Select + ' svg' ).attr( 'viewBox', '0 0 ' + scope.width + ' ' + scope.height ).datum( data ).transition().duration( attrs.transitionduration === undefined ? 250 : +attrs.transitionduration ).call( chart ); 799 } 800 801 function updateDimensions( scope, attrs, element, chart ) { 802 if ( chart ) { 803 chart.width( scope.width ).height( scope.height ); 804 var d3Select = getD3Selector( attrs, element ); 805 d3.select( d3Select + ' svg' ).attr( 'viewBox', '0 0 ' + scope.width + ' ' + scope.height ); 806 nv.utils.windowResize( chart ); 807 scope.chart.update(); 808 } 809 } 810 angular.module( 'nvd3ChartDirectives', [] ).directive( 'nvd3LineChart', [ 811 '$filter', 812 function ( $filter ) { 813 return { 814 restrict: 'EA', 815 scope: { 816 data: '=', 817 filtername: '=', 818 filtervalue: '=', 819 width: '@', 820 height: '@', 821 id: '@', 822 showlegend: '@', 823 tooltips: '@', 824 showxaxis: '@', 825 showyaxis: '@', 826 rightalignyaxis: '@', 827 defaultstate: '@', 828 nodata: '@', 829 margin: '&', 830 tooltipcontent: '&', 831 color: '&', 832 x: '&', 833 y: '&', 834 forcex: '@', 835 forcey: '@', 836 isArea: '@', 837 interactive: '@', 838 clipedge: '@', 839 clipvoronoi: '@', 840 interpolate: '@', 841 callback: '&', 842 useinteractiveguideline: '@', 843 xaxisorient: '&', 844 xaxisticks: '@', 845 xaxistickvalues: '&xaxistickvalues', 846 xaxisticksubdivide: '&', 847 xaxisticksize: '&', 848 xaxistickpadding: '&', 849 xaxistickformat: '&', 850 xaxislabel: '@', 851 xaxisscale: '&', 852 xaxisdomain: '&', 853 xaxisrange: '&', 854 xaxisrangeband: '&', 855 xaxisrangebands: '&', 856 xaxisshowmaxmin: '@', 857 xaxishighlightzero: '@', 858 xaxisrotatelabels: '@', 859 xaxisrotateylabel: '@', 860 xaxisstaggerlabels: '@', 861 xaxislabeldistance: '@', 862 yaxisorient: '&', 863 yaxisticks: '&', 864 yaxistickvalues: '&yaxistickvalues', 865 yaxisticksubdivide: '&', 866 yaxisticksize: '&', 867 yaxistickpadding: '&', 868 yaxistickformat: '&', 869 yaxislabel: '@', 870 yaxisscale: '&', 871 yaxisdomain: '&', 872 yaxisrange: '&', 873 yaxisrangeband: '&', 874 yaxisrangebands: '&', 875 yaxisshowmaxmin: '@', 876 yaxishighlightzero: '@', 877 yaxisrotatelabels: '@', 878 yaxisrotateylabel: '@', 879 yaxisstaggerlabels: '@', 880 yaxislabeldistance: '@', 881 legendmargin: '&', 882 legendwidth: '@', 883 legendheight: '@', 884 legendkey: '@', 885 legendcolor: '&', 886 legendalign: '@', 887 legendrightalign: '@', 888 legendupdatestate: '@', 889 legendradiobuttonmode: '@', 890 objectequality: '@', 891 transitionduration: '@' 892 }, 893 controller: [ 894 '$scope', 895 '$element', 896 '$attrs',
897 function ( $scope, $element, $attrs ) { 898 $scope.d3Call = function ( data, chart ) { 899 checkElementID( $scope, $attrs, $element, chart, data ); 900 }; 901 } 902 ], 903 link: function ( scope, element, attrs ) { 904 scope.$watch( 'width + height', function () { 905 updateDimensions( scope, attrs, element, scope.chart ); 906 } ); 907 scope.$watch( 'data', function ( data ) { 908 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 909 data = $filter( scope.filtername )( data, scope.filtervalue ); 910 } 911 if ( data ) { 912 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 913 if ( scope.chart ) { 914 return scope.d3Call( data, scope.chart ); 915 } 916 nv.addGraph( { 917 generate: function () { 918 initializeMargin( scope, attrs ); 919 var chart = nv.models.lineChart().width( scope.width ).height( scope.height ).margin( scope.margin ).x( attrs.x === undefined ? function ( d ) { 920 return d[ 0 ]; 921 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 922 return d[ 1 ]; 923 } : scope.y() ).forceX( attrs.forcex === undefined ? [] : scope.$eval( attrs.forcex ) ).forceY( attrs.forcey === undefined ? [ 0 ] : scope.$eval( attrs.forcey ) ).showLegend( attrs.showlegend === undefined ? false : attrs.showlegend === 'true' ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).showXAxis( attrs.showxaxis === undefined ? false : attrs.showxaxis === 'true' ).showYAxis( attrs.showyaxis === undefined ? false : attrs.showyaxis === 'true' ).rightAlignYAxis( attrs.rightalignyaxis === undefined ? false : attrs.rightalignyaxis === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ).interactive( attrs.interactive === undefined ? false : attrs.interactive === 'true' ).clipEdge( attrs.clipedge === undefined ? false : attrs.clipedge === 'true' ).clipVoronoi( attrs.clipvoronoi === undefined ? false : attrs.clipvoronoi === 'true' ).interpolate( attrs.interpolate === undefined ? 'linear' : attrs.interpolate ).color( attrs.color === undefined ? nv.utils.defaultColor() : scope.color() ).isArea( attrs.isarea === undefined ? function ( d ) { 924 return d.area; 925 } : function () { 926 return attrs.isarea === 'true'; 927 } ); 928 if ( attrs.useinteractiveguideline ) { 929 chart.useInteractiveGuideline( attrs.useinteractiveguideline === undefined ? false : attrs.useinteractiveguideline === 'true' ); 930 } 931 if ( attrs.tooltipcontent ) { 932 chart.tooltipContent( scope.tooltipcontent() ); 933 } 934 scope.d3Call( data, chart ); 935 nv.utils.windowResize( chart.update ); 936 scope.chart = chart; 937 return chart; 938 }, 939 callback: attrs.callback === undefined ? null : scope.callback() 940 } ); 941 } 942 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 943 } 944 }; 945 } 946 ] ).directive( 'nvd3CumulativeLineChart', [ 947 '$filter', 948 function ( $filter ) { 949 return { 950 restrict: 'EA', 951 scope: { 952 data: '=', 953 filtername: '=', 954 filtervalue: '=', 955 width: '@', 956 height: '@', 957 id: '@', 958 showlegend: '@', 959 tooltips: '@', 960 showxaxis: '@', 961 showyaxis: '@', 962 rightalignyaxis: '@', 963 defaultstate: '@', 964 nodata: '@', 965 margin: '&', 966 tooltipcontent: '&', 967 color: '&', 968 x: '&', 969 y: '&', 970 forcex: '@', 971 forcey: '@', 972 isArea: '@', 973 interactive: '@', 974 clipedge: '@', 975 clipvoronoi: '@', 976 usevoronoi: '@', 977 average: '&', 978 rescaley: '@', 979 callback: '&', 980 useinteractiveguideline: '@', 981 xaxisorient: '&', 982 xaxisticks: '&', 983 xaxistickvalues: '&xaxistickvalues', 984 xaxisticksubdivide: '&', 985 xaxisticksize: '&', 986 xaxistickpadding: '&', 987 xaxistickformat: '&', 988 xaxislabel: '@', 989 xaxisscale: '&', 990 xaxisdomain: '&', 991 xaxisrange: '&', 992 xaxisrangeband: '&', 993 xaxisrangebands: '&', 994 xaxisshowmaxmin: '@', 995 xaxishighlightzero: '@', 996 xaxisrotatelabels: '@', 997 xaxisrotateylabel: '@', 998 xaxisstaggerlabels: '@', 999 xaxislabeldistance: '@', 1000 yaxisorient: '&', 1001 yaxisticks: '&', 1002 yaxistickvalues: '&yaxistickvalues', 1003 yaxisticksubdivide: '&', 1004 yaxisticksize: '&', 1005 yaxistickpadding: '&', 1006 yaxistickformat: '&', 1007 yaxislabel: '@', 1008 yaxisscale: '&', 1009 yaxisdomain: '&', 1010 yaxisrange: '&', 1011 yaxisrangeband: '&', 1012 yaxisrangebands: '&', 1013 yaxisshowmaxmin: '@', 1014 yaxishighlightzero: '@', 1015 yaxisrotatelabels: '@', 1016 yaxisrotateylabel: '@', 1017 yaxisstaggerlabels: '@', 1018 yaxislabeldistance: '@', 1019 legendmargin: '&', 1020 legendwidth: '@', 1021 legendheight: '@', 1022 legendkey: '@', 1023 legendcolor: '&', 1024 legendalign: '@', 1025 legendrightalign: '@', 1026 legendupdatestate: '@', 1027 legendradiobuttonmode: '@', 1028 objectequality: '@', 1029 transitionduration: '@' 1030 }, 1031 controller: [ 1032 '$scope', 1033 '$element', 1034 '$attrs',
1035 function ( $scope, $element, $attrs ) { 1036 $scope.d3Call = function ( data, chart ) { 1037 checkElementID( $scope, $attrs, $element, chart, data ); 1038 }; 1039 } 1040 ], 1041 link: function ( scope, element, attrs ) { 1042 scope.$watch( 'width + height', function () { 1043 updateDimensions( scope, attrs, element, scope.chart ); 1044 } ); 1045 scope.$watch( 'data', function ( data ) { 1046 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 1047 data = $filter( scope.filtername )( data, scope.filtervalue ); 1048 } 1049 if ( data ) { 1050 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 1051 if ( scope.chart ) { 1052 return scope.d3Call( data, scope.chart ); 1053 } 1054 nv.addGraph( { 1055 generate: function () { 1056 initializeMargin( scope, attrs ); 1057 var chart = nv.models.cumulativeLineChart().width( scope.width ).height( scope.height ).margin( scope.margin ).x( attrs.x === undefined ? function ( d ) { 1058 return d[ 0 ]; 1059 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 1060 return d[ 1 ]; 1061 } : scope.y() ).forceX( attrs.forcex === undefined ? [] : scope.$eval( attrs.forcex ) ).forceY( attrs.forcey === undefined ? [ 0 ] : scope.$eval( attrs.forcey ) ).showLegend( attrs.showlegend === undefined ? false : attrs.showlegend === 'true' ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).showXAxis( attrs.showxaxis === undefined ? false : attrs.showxaxis === 'true' ).showYAxis( attrs.showyaxis === undefined ? false : attrs.showyaxis === 'true' ).rightAlignYAxis( attrs.rightalignyaxis === undefined ? false : attrs.rightalignyaxis === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ).interactive( attrs.interactive === undefined ? false : attrs.interactive === 'true' ).clipEdge( attrs.clipedge === undefined ? false : attrs.clipedge === 'true' ).clipVoronoi( attrs.clipvoronoi === undefined ? false : attrs.clipvoronoi === 'true' ).useVoronoi( attrs.usevoronoi === undefined ? false : attrs.usevoronoi === 'true' ).average( attrs.average === undefined ? function ( d ) { 1062 return d.average; 1063 } : scope.average() ).color( attrs.color === undefined ? d3.scale.category10().range() : scope.color() ).isArea( attrs.isarea === undefined ? function ( d ) { 1064 return d.area; 1065 } : attrs.isarea === 'true' ); 1066 //.rescaleY(attrs.rescaley === undefined ? false : (attrs.rescaley === 'true')); 1067 if ( attrs.useinteractiveguideline ) { 1068 chart.useInteractiveGuideline( attrs.useinteractiveguideline === undefined ? false : attrs.useinteractiveguideline === 'true' ); 1069 } 1070 if ( attrs.tooltipcontent ) { 1071 chart.tooltipContent( scope.tooltipcontent() ); 1072 } 1073 scope.d3Call( data, chart ); 1074 nv.utils.windowResize( chart.update ); 1075 scope.chart = chart; 1076 return chart; 1077 }, 1078 callback: attrs.callback === undefined ? null : scope.callback() 1079 } ); 1080 } 1081 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 1082 } 1083 }; 1084 } 1085 ] ).directive( 'nvd3StackedAreaChart', [ 1086 '$filter', 1087 function ( $filter ) { 1088 return { 1089 restrict: 'EA', 1090 scope: { 1091 data: '=', 1092 filtername: '=', 1093 filtervalue: '=', 1094 width: '@', 1095 height: '@', 1096 id: '@', 1097 showlegend: '@', 1098 tooltips: '@', 1099 showcontrols: '@', 1100 nodata: '@', 1101 margin: '&', 1102 tooltipcontent: '&', 1103 color: '&', 1104 x: '&', 1105 y: '&', 1106 forcex: '@', 1107 forcey: '@', 1108 forcesize: '@', 1109 interactive: '@', 1110 usevoronoi: '@', 1111 clipedge: '@', 1112 interpolate: '@', 1113 style: '@', 1114 order: '@', 1115 offset: '@', 1116 size: '&', 1117 xScale: '&', 1118 yScale: '&', 1119 xDomain: '&', 1120 yDomain: '&', 1121 xRange: '&', 1122 yRange: '&', 1123 sizeDomain: '&', 1124 callback: '&', 1125 showxaxis: '&', 1126 xaxisorient: '&', 1127 xaxisticks: '&', 1128 xaxistickvalues: '&xaxistickvalues', 1129 xaxisticksubdivide: '&', 1130 xaxisticksize: '&', 1131 xaxistickpadding: '&', 1132 xaxistickformat: '&', 1133 xaxislabel: '@', 1134 xaxisscale: '&', 1135 xaxisdomain: '&', 1136 xaxisrange: '&', 1137 xaxisrangeband: '&', 1138 xaxisrangebands: '&', 1139 xaxisshowmaxmin: '@', 1140 xaxishighlightzero: '@', 1141 xaxisrotatelabels: '@', 1142 xaxisrotateylabel: '@', 1143 xaxisstaggerlabels: '@', 1144 xaxisaxislabeldistance: '@', 1145 showyaxis: '&', 1146 useinteractiveguideline: '@', 1147 yaxisorient: '&', 1148 yaxisticks: '&', 1149 yaxistickvalues: '&yaxistickvalues', 1150 yaxisticksubdivide: '&', 1151 yaxisticksize: '&', 1152 yaxistickpadding: '&', 1153 yaxistickformat: '&', 1154 yaxislabel: '@', 1155 yaxisscale: '&', 1156 yaxisdomain: '&', 1157 yaxisrange: '&', 1158 yaxisrangeband: '&', 1159 yaxisrangebands: '&', 1160 yaxisshowmaxmin: '@', 1161 yaxishighlightzero: '@', 1162 yaxisrotatelabels: '@', 1163 yaxisrotateylabel: '@', 1164 yaxisstaggerlabels: '@', 1165 yaxislabeldistance: '@', 1166 legendmargin: '&', 1167 legendwidth: '@', 1168 legendheight: '@', 1169 legendkey: '@', 1170 legendcolor: '&', 1171 legendalign: '@', 1172 legendrightalign: '@', 1173 legendupdatestate: '@', 1174 legendradiobuttonmode: '@', 1175 objectequality: '@', 1176 transitionduration: '@' 1177 }, 1178 controller: [ 1179 '$scope', 1180 '$element', 1181 '$attrs',
1182 function ( $scope, $element, $attrs ) { 1183 $scope.d3Call = function ( data, chart ) { 1184 checkElementID( $scope, $attrs, $element, chart, data ); 1185 }; 1186 } 1187 ], 1188 link: function ( scope, element, attrs ) { 1189 scope.$watch( 'width + height', function () { 1190 updateDimensions( scope, attrs, element, scope.chart ); 1191 } ); 1192 scope.$watch( 'data', function ( data ) { 1193 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 1194 data = $filter( scope.filtername )( data, scope.filtervalue ); 1195 } 1196 if ( data ) { 1197 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 1198 if ( scope.chart ) { 1199 return scope.d3Call( data, scope.chart ); 1200 } 1201 nv.addGraph( { 1202 generate: function () { 1203 initializeMargin( scope, attrs ); 1204 var chart = nv.models.stackedAreaChart().width( scope.width ).height( scope.height ).margin( scope.margin ).x( attrs.x === undefined ? function ( d ) { 1205 return d[ 0 ]; 1206 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 1207 return d[ 1 ]; 1208 } : scope.y() ).forceX( attrs.forcex === undefined ? [] : scope.$eval( attrs.forcex ) ).forceY( attrs.forcey === undefined ? [ 0 ] : scope.$eval( attrs.forcey ) ).size( attrs.size === undefined ? function ( d ) { 1209 return d.size === undefined ? 1 : d.size; 1210 } : scope.size() ).forceSize( attrs.forcesize === undefined ? [] : scope.$eval( attrs.forcesize ) ).showLegend( attrs.showlegend === undefined ? false : attrs.showlegend === 'true' ).showControls( attrs.showcontrols === undefined ? false : attrs.showcontrols === 'true' ).showXAxis( attrs.showxaxis === undefined ? false : attrs.showxaxis === 'true' ).showYAxis( attrs.showyaxis === undefined ? false : attrs.showyaxis === 'true' ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ).interactive( attrs.interactive === undefined ? false : attrs.interactive === 'true' ).clipEdge( attrs.clipedge === undefined ? false : attrs.clipedge === 'true' ).color( attrs.color === undefined ? nv.utils.defaultColor() : scope.color() ); 1211 if ( attrs.useinteractiveguideline ) { 1212 chart.useInteractiveGuideline( attrs.useinteractiveguideline === undefined ? false : attrs.useinteractiveguideline === 'true' ); 1213 } 1214 if ( attrs.usevoronoi ) { 1215 chart.useVoronoi( attrs.usevoronoi === 'true' ); 1216 } 1217 if ( attrs.style ) { 1218 chart.style( attrs.style ); 1219 } 1220 if ( attrs.order ) { 1221 chart.order( attrs.order ); 1222 } 1223 if ( attrs.offset ) { 1224 chart.offset( attrs.offset ); 1225 } 1226 if ( attrs.interpolate ) { 1227 chart.interpolate( attrs.interpolate ); 1228 } 1229 if ( attrs.tooltipcontent ) { 1230 chart.tooltipContent( scope.tooltipcontent() ); 1231 } 1232 if ( attrs.xscale ) { 1233 chart.xScale( scope.xscale() ); 1234 } 1235 if ( attrs.yscale ) { 1236 chart.yScale( scope.yscale() ); 1237 } 1238 if ( attrs.xdomain ) { 1239 if ( Array.isArray( scope.$eval( attrs.xdomain ) ) ) { 1240 chart.xDomain( scope.$eval( attrs.xdomain ) ); 1241 } else if ( typeof scope.xdomain() === 'function' ) { 1242 chart.xDomain( scope.xdomain() ); 1243 } 1244 } 1245 if ( attrs.ydomain ) { 1246 if ( Array.isArray( scope.$eval( attrs.ydomain ) ) ) { 1247 chart.yDomain( scope.$eval( attrs.ydomain ) ); 1248 } else if ( typeof scope.ydomain() === 'function' ) { 1249 chart.yDomain( scope.ydomain() ); 1250 } 1251 } 1252 if ( attrs.sizedomain ) { 1253 chart.sizeDomain( scope.sizedomain() ); 1254 } 1255 scope.d3Call( data, chart ); 1256 nv.utils.windowResize( chart.update ); 1257 scope.chart = chart; 1258 return chart; 1259 }, 1260 callback: attrs.callback === undefined ? null : scope.callback() 1261 } ); 1262 } 1263 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 1264 } 1265 }; 1266 } 1267 ] ).directive( 'nvd3MultiBarChart', [ 1268 '$filter', 1269 function ( $filter ) { 1270 return { 1271 restrict: 'EA', 1272 scope: { 1273 data: '=', 1274 filtername: '=', 1275 filtervalue: '=', 1276 width: '@', 1277 height: '@', 1278 id: '@', 1279 showlegend: '@', 1280 tooltips: '@', 1281 tooltipcontent: '&', 1282 color: '&', 1283 showcontrols: '@', 1284 nodata: '@', 1285 reducexticks: '@', 1286 staggerlabels: '@', 1287 rotatelabels: '@', 1288 margin: '&', 1289 x: '&', 1290 y: '&', 1291 forcey: '@', 1292 delay: '@', 1293 stacked: '@', 1294 callback: '&', 1295 showxaxis: '&', 1296 xaxisorient: '&', 1297 xaxisticks: '&', 1298 xaxistickvalues: '&xaxistickvalues', 1299 xaxisticksubdivide: '&', 1300 xaxisticksize: '&', 1301 xaxistickpadding: '&', 1302 xaxistickformat: '&', 1303 xaxislabel: '@', 1304 xaxisscale: '&', 1305 xaxisdomain: '&', 1306 xaxisrange: '&', 1307 xaxisrangeband: '&', 1308 xaxisrangebands: '&', 1309 xaxisshowmaxmin: '@', 1310 xaxishighlightzero: '@', 1311 xaxisrotatelabels: '@', 1312 xaxisrotateylabel: '@', 1313 xaxisstaggerlabels: '@', 1314 xaxisaxislabeldistance: '@', 1315 showyaxis: '&', 1316 yaxisorient: '&', 1317 yaxisticks: '&', 1318 yaxistickvalues: '&yaxistickvalues', 1319 yaxisticksubdivide: '&', 1320 yaxisticksize: '&', 1321 yaxistickpadding: '&', 1322 yaxistickformat: '&', 1323 yaxislabel: '@', 1324 yaxisscale: '&', 1325 yaxisdomain: '&', 1326 yaxisrange: '&', 1327 yaxisrangeband: '&', 1328 yaxisrangebands: '&', 1329 yaxisshowmaxmin: '@', 1330 yaxishighlightzero: '@', 1331 yaxisrotatelabels: '@', 1332 yaxisrotateylabel: '@', 1333 yaxisstaggerlabels: '@', 1334 yaxislabeldistance: '@', 1335 legendmargin: '&', 1336 legendwidth: '@', 1337 legendheight: '@', 1338 legendkey: '@', 1339 legendcolor: '&', 1340 legendalign: '@', 1341 legendrightalign: '@', 1342 legendupdatestate: '@', 1343 legendradiobuttonmode: '@', 1344 objectequality: '@', 1345 transitionduration: '@' 1346 }, 1347 controller: [ 1348 '$scope', 1349 '$element', 1350 '$attrs',
1351 function ( $scope, $element, $attrs ) { 1352 $scope.d3Call = function ( data, chart ) { 1353 checkElementID( $scope, $attrs, $element, chart, data ); 1354 }; 1355 } 1356 ], 1357 link: function ( scope, element, attrs ) { 1358 scope.$watch( 'width + height', function () { 1359 updateDimensions( scope, attrs, element, scope.chart ); 1360 } ); 1361 scope.$watch( 'data', function ( data ) { 1362 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 1363 data = $filter( scope.filtername )( data, scope.filtervalue ); 1364 } 1365 if ( data ) { 1366 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 1367 if ( scope.chart ) { 1368 return scope.d3Call( data, scope.chart ); 1369 } 1370 nv.addGraph( { 1371 generate: function () { 1372 initializeMargin( scope, attrs ); 1373 var chart = nv.models.multiBarChart().width( scope.width ).height( scope.height ).margin( scope.margin ).x( attrs.x === undefined ? function ( d ) { 1374 return d[ 0 ]; 1375 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 1376 return d[ 1 ]; 1377 } : scope.y() ).forceY( attrs.forcey === undefined ? [ 0 ] : scope.$eval( attrs.forcey ) ).showLegend( attrs.showlegend === undefined ? false : attrs.showlegend === 'true' ).showControls( attrs.showcontrols === undefined ? false : attrs.showcontrols === 'true' ).showXAxis( attrs.showxaxis === undefined ? false : attrs.showxaxis === 'true' ).showYAxis( attrs.showyaxis === undefined ? false : attrs.showyaxis === 'true' ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).reduceXTicks( attrs.reducexticks === undefined ? false : attrs.reducexticks === 'true' ).staggerLabels( attrs.staggerlabels === undefined ? false : attrs.staggerlabels === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ).rotateLabels( attrs.rotatelabels === undefined ? 0 : attrs.rotatelabels ).color( attrs.color === undefined ? nv.utils.defaultColor() : scope.color() ).delay( attrs.delay
1377=== undefined ? 1200 : attrs.delay ).stacked( attrs.stacked === undefined ? false : attrs.stacked === 'true' ); 1378 if ( attrs.tooltipcontent ) { 1379 chart.tooltipContent( scope.tooltipcontent() ); 1380 } 1381 scope.d3Call( data, chart ); 1382 nv.utils.windowResize( chart.update ); 1383 scope.chart = chart; 1384 return chart; 1385 }, 1386 callback: attrs.callback === undefined ? null : scope.callback() 1387 } ); 1388 } 1389 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 1390 } 1391 }; 1392 } 1393 ] ).directive( 'nvd3DiscreteBarChart', [ 1394 '$filter', 1395 function ( $filter ) { 1396 return { 1397 restrict: 'EA', 1398 scope: { 1399 data: '=', 1400 filtername: '=', 1401 filtervalue: '=', 1402 width: '@', 1403 height: '@', 1404 id: '@', 1405 tooltips: '@', 1406 showxaxis: '@', 1407 showyaxis: '@', 1408 tooltipcontent: '&', 1409 staggerlabels: '@', 1410 color: '&', 1411 margin: '&', 1412 nodata: '@', 1413 x: '&', 1414 y: '&', 1415 forcey: '@', 1416 showvalues: '@', 1417 valueformat: '&', 1418 callback: '&', 1419 xaxisorient: '&', 1420 xaxisticks: '&', 1421 xaxistickvalues: '&xaxistickvalues', 1422 xaxisticksubdivide: '&', 1423 xaxisticksize: '&', 1424 xaxistickpadding: '&', 1425 xaxistickformat: '&', 1426 xaxislabel: '@', 1427 xaxisscale: '&', 1428 xaxisdomain: '&', 1429 xaxisrange: '&', 1430 xaxisrangeband: '&', 1431 xaxisrangebands: '&', 1432 xaxisshowmaxmin: '@', 1433 xaxishighlightzero: '@', 1434 xaxisrotatelabels: '@', 1435 xaxisrotateylabel: '@', 1436 xaxisstaggerlabels: '@', 1437 xaxisaxislabeldistance: '@', 1438 yaxisorient: '&', 1439 yaxisticks: '&', 1440 yaxistickvalues: '&yaxistickvalues', 1441 yaxisticksubdivide: '&', 1442 yaxisticksize: '&', 1443 yaxistickpadding: '&', 1444 yaxistickformat: '&', 1445 yaxislabel: '@', 1446 yaxisscale: '&', 1447 yaxisdomain: '&', 1448 yaxisrange: '&', 1449 yaxisrangeband: '&', 1450 yaxisrangebands: '&', 1451 yaxisshowmaxmin: '@', 1452 yaxishighlightzero: '@', 1453 yaxisrotatelabels: '@', 1454 yaxisrotateylabel: '@', 1455 yaxisstaggerlabels: '@', 1456 yaxislabeldistance: '@', 1457 legendmargin: '&', 1458 legendwidth: '@', 1459 legendheight: '@', 1460 legendkey: '@', 1461 legendcolor: '&', 1462 legendalign: '@', 1463 legendrightalign: '@', 1464 legendupdatestate: '@', 1465 legendradiobuttonmode: '@', 1466 objectequality: '@', 1467 transitionduration: '@' 1468 }, 1469 controller: [ 1470 '$scope', 1471 '$element', 1472 '$attrs', 1473 function ( $scope, $element, $attrs ) { 1474 $scope.d3Call = function ( data, chart ) { 1475 checkElementID( $scope, $attrs, $element, chart, data ); 1476 }; 1477 } 1478 ], 1479 link: function ( scope, element, attrs ) { 1480 scope.$watch( 'width + height', function () { 1481 updateDimensions( scope, attrs, element, scope.chart ); 1482 } ); 1483 scope.$watch( 'data', function ( data ) { 1484 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 1485 data = $filter( scope.filtername )( data, scope.filtervalue ); 1486 } 1487 if ( data ) { 1488 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 1489 if ( scope.chart ) { 1490 return scope.d3Call( data, scope.chart ); 1491 } 1492 nv.addGraph( { 1493 generate: function () { 1494 initializeMargin( scope, attrs ); 1495 var chart = nv.models.discreteBarChart().width( scope.width ).height( scope.height ).margin( scope.margin ).x( attrs.x === undefined ? function ( d ) { 1496 return d[ 0 ]; 1497 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 1498 return d[ 1 ]; 1499 } : scope.y() ).forceY( attrs.forcey === undefined ? [ 0 ] : scope.$eval( attrs.forcey ) ).showValues( attrs.showvalues === undefined ? false : attrs.showvalues === 'true' ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).showXAxis( attrs.showxaxis === undefined ? false : attrs.showxaxis === 'true' ).showYAxis( attrs.showyaxis === undefined ? false : attrs.showyaxis === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ).staggerLabels( attrs.staggerlabels === undefined ? false : attrs.staggerlabels === 'true' ).color( attrs.color === undefined ? nv.utils.defaultColor() : scope.color() ); 1500 if ( attrs.tooltipcontent ) { 1501 chart.tooltipContent( scope.tooltipcontent() ); 1502 } 1503 if ( attrs.valueformat ) { 1504 chart.valueFormat( scope.valueformat() ); 1505 } 1506 scope.d3Call( data, chart ); 1507 nv.utils.windowResize( chart.update ); 1508 scope.chart = chart; 1509 return chart; 1510 }, 1511 callback: attrs.callback === undefined ? null : scope.callback() 1512 } ); 1513 } 1514 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 1515 } 1516 }; 1517 } 1518 ] ).directive( 'nvd3HistoricalBarChart', [ 1519 '$filter', 1520 function ( $filter ) { 1521 return { 1522 restrict: 'EA', 1523 scope: { 1524 data: '=', 1525 filtername: '=', 1526 filtervalue: '=', 1527 width: '@', 1528 height: '@', 1529 id: '@', 1530 tooltips: '@', 1531 tooltipcontent: '&', 1532 color: '&', 1533 margin: '&', 1534 nodata: '@', 1535 x: '&', 1536 y: '&', 1537 forcey: '@', 1538 isarea: '@', 1539 interactive: '@', 1540 clipedge: '@', 1541 clipvoronoi: '@', 1542 interpolate: '@', 1543 highlightPoint: '@', 1544 clearHighlights: '@', 1545 callback: '&', 1546 useinteractiveguideline: '@', 1547 xaxisorient: '&', 1548 xaxisticks: '&', 1549 xaxistickvalues: '&xaxistickvalues', 1550 xaxisticksubdivide: '&', 1551 xaxisticksize: '&', 1552 xaxistickpadding: '&', 1553 xaxistickformat: '&', 1554 xaxislabel: '@', 1555 xaxisscale: '&', 1556 xaxisdomain: '&', 1557 xaxisrange: '&', 1558 xaxisrangeband: '&', 1559 xaxisrangebands: '&', 1560 xaxisshowmaxmin: '@', 1561 xaxishighlightzero: '@', 1562 xaxisrotatelabels: '@', 1563 xaxisrotateylabel: '@', 1564 xaxisstaggerlabels: '@', 1565 xaxisaxislabeldistance: '@', 1566 yaxisorient: '&', 1567 yaxisticks: '&', 1568 yaxistickvalues: '&yaxistickvalues', 1569 yaxisticksubdivide: '&', 1570 yaxisticksize: '&', 1571 yaxistickpadding: '&', 1572 yaxistickformat: '&', 1573 yaxislabel: '@', 1574 yaxisscale: '&', 1575 yaxisdomain: '&', 1576 yaxisrange: '&', 1577 yaxisrangeband: '&', 1578 yaxisrangebands: '&', 1579 yaxisshowmaxmin: '@', 1580 yaxishighlightzero: '@', 1581 yaxisrotatelabels: '@', 1582 yaxisrotateylabel: '@', 1583 yaxisstaggerlabels: '@', 1584 yaxislabeldistance: '@', 1585 legendmargin: '&', 1586 legendwidth: '@', 1587 legendheight: '@', 1588 legendkey: '@', 1589 legendcolor: '&', 1590 legendalign: '@', 1591 legendrightalign: '@', 1592 legendupdatestate: '@', 1593 legendradiobuttonmode: '@', 1594 objectequality: '@', 1595 transitionduration: '@' 1596 }, 1597 controller: [ 1598 '$scope', 1599 '$element', 1600 '$attrs',
1601 function ( $scope, $element, $attrs ) { 1602 $scope.d3Call = function ( data, chart ) { 1603 checkElementID( $scope, $attrs, $element, chart, data ); 1604 }; 1605 } 1606 ], 1607 link: function ( scope, element, attrs ) { 1608 scope.$watch( 'width + height', function () { 1609 updateDimensions( scope, attrs, element, scope.chart ); 1610 } ); 1611 scope.$watch( 'data', function ( data ) { 1612 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 1613 data = $filter( scope.filtername )( data, scope.filtervalue ); 1614 } 1615 if ( data ) { 1616 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 1617 if ( scope.chart ) { 1618 return scope.d3Call( data, scope.chart ); 1619 } 1620 nv.addGraph( { 1621 generate: function () { 1622 initializeMargin( scope, attrs ); 1623 var chart = nv.models.historicalBarChart().width( scope.width ).height( scope.height ).margin( scope.margin ).x( attrs.x === undefined ? function ( d ) { 1624 return d[ 0 ]; 1625 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 1626 return d[ 1 ]; 1627 } : scope.y() ).forceY( attrs.forcey === undefined ? [ 0 ] : scope.$eval( attrs.forcey ) ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ).interactive( attrs.interactive === undefined ? false : attrs.interactive === 'true' ).color( attrs.color === undefined ? nv.utils.defaultColor() : scope.color() ); 1628 if ( attrs.useinteractiveguideline ) { 1629 chart.useInteractiveGuideline( attrs.useinteractiveguideline === undefined ? false : attrs.useinteractiveguideline === 'true' ); 1630 } 1631 if ( attrs.tooltipcontent ) { 1632 chart.tooltipContent( scope.tooltipcontent() ); 1633 } 1634 if ( attrs.valueformat ) { 1635 chart.valueFormat( scope.valueformat() ); 1636 } 1637 scope.d3Call( data, chart ); 1638 nv.utils.windowResize( chart.update ); 1639 scope.chart = chart; 1640 return chart; 1641 }, 1642 callback: attrs.callback === undefined ? null : scope.callback() 1643 } ); 1644 } 1645 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 1646 } 1647 }; 1648 } 1649 ] ).directive( 'nvd3MultiBarHorizontalChart', [ 1650 '$filter', 1651 function ( $filter ) { 1652 return { 1653 restrict: 'EA', 1654 scope: { 1655 data: '=', 1656 filtername: '=', 1657 filtervalue: '=', 1658 width: '@', 1659 height: '@', 1660 id: '@', 1661 showlegend: '@', 1662 tooltips: '@', 1663 tooltipcontent: '&', 1664 color: '&', 1665 showcontrols: '@', 1666 margin: '&', 1667 nodata: '@', 1668 x: '&', 1669 y: '&', 1670 forcey: '@', 1671 stacked: '@', 1672 showvalues: '@', 1673 valueformat: '&', 1674 callback: '&', 1675 xaxisorient: '&', 1676 xaxisticks: '&', 1677 xaxistickvalues: '&xaxistickvalues', 1678 xaxisticksubdivide: '&', 1679 xaxisticksize: '&', 1680 xaxistickpadding: '&', 1681 xaxistickformat: '&', 1682 xaxislabel: '@', 1683 xaxisscale: '&', 1684 xaxisdomain: '&', 1685 xaxisrange: '&', 1686 xaxisrangeband: '&', 1687 xaxisrangebands: '&', 1688 xaxisshowmaxmin: '@', 1689 xaxishighlightzero: '@', 1690 xaxisrotatelabels: '@', 1691 xaxisrotateylabel: '@', 1692 xaxisstaggerlabels: '@', 1693 xaxisaxislabeldistance: '@', 1694 yaxisorient: '&', 1695 yaxisticks: '&', 1696 yaxistickvalues: '&yaxistickvalues', 1697 yaxisticksubdivide: '&', 1698 yaxisticksize: '&', 1699 yaxistickpadding: '&', 1700 yaxistickformat: '&', 1701 yaxislabel: '@', 1702 yaxisscale: '&', 1703 yaxisdomain: '&', 1704 yaxisrange: '&', 1705 yaxisrangeband: '&', 1706 yaxisrangebands: '&', 1707 yaxisshowmaxmin: '@', 1708 yaxishighlightzero: '@', 1709 yaxisrotatelabels: '@', 1710 yaxisrotateylabel: '@', 1711 yaxisstaggerlabels: '@', 1712 yaxislabeldistance: '@', 1713 legendmargin: '&', 1714 legendwidth: '@', 1715 legendheight: '@', 1716 legendkey: '@', 1717 legendcolor: '&', 1718 legendalign: '@', 1719 legendrightalign: '@', 1720 legendupdatestate: '@', 1721 legendradiobuttonmode: '@', 1722 objectequality: '@', 1723 transitionduration: '@' 1724 }, 1725 controller: [ 1726 '$scope', 1727 '$element', 1728 '$attrs',
1729 function ( $scope, $element, $attrs ) { 1730 $scope.d3Call = function ( data, chart ) { 1731 checkElementID( $scope, $attrs, $element, chart, data ); 1732 }; 1733 } 1734 ], 1735 link: function ( scope, element, attrs ) { 1736 scope.$watch( 'width + height', function () { 1737 updateDimensions( scope, attrs, element, scope.chart ); 1738 } ); 1739 scope.$watch( 'data', function ( data ) { 1740 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 1741 data = $filter( scope.filtername )( data, scope.filtervalue ); 1742 } 1743 if ( data ) { 1744 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 1745 if ( scope.chart ) { 1746 return scope.d3Call( data, scope.chart ); 1747 } 1748 nv.addGraph( { 1749 generate: function () { 1750 initializeMargin( scope, attrs ); 1751 var chart = nv.models.multiBarHorizontalChart().width( scope.width ).height( scope.height ).margin( scope.margin ).x( attrs.x === undefined ? function ( d ) { 1752 return d[ 0 ]; 1753 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 1754 return d[ 1 ]; 1755 } : scope.y() ).showXAxis( attrs.showxaxis === undefined ? false : attrs.showxaxis === 'true' ).showYAxis( attrs.showyaxis === undefined ? false : attrs.showyaxis === 'true' ).forceY( attrs.forcey === undefined ? [ 0 ] : scope.$eval( attrs.forcey ) ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ).color( attrs.color === undefined ? nv.utils.defaultColor() : scope.color() ).showLegend( attrs.showlegend === undefined ? false : attrs.showlegend === 'true' ).showControls( attrs.showcontrols === undefined ? false : attrs.showcontrols === 'true' ).showValues( attrs.showvalues === undefined ? false : attrs.showvalues === 'true' ).stacked( attrs.stacked === undefined ? false : attrs.stacked === 'true' ); 1756 if ( attrs.tooltipcontent ) { 1757 chart.tooltipContent( scope.tooltipcontent() ); 1758 } 1759 if ( attrs.valueformat ) { 1760 chart.valueFormat( scope.valueformat() ); 1761 } 1762 scope.d3Call( data, chart ); 1763 nv.utils.windowResize( chart.update ); 1764 scope.chart = chart; 1765 return chart; 1766 }, 1767 callback: attrs.callback === undefined ? null : scope.callback() 1768 } ); 1769 } 1770 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 1771 } 1772 }; 1773 } 1774 ] ).directive( 'nvd3PieChart', [ 1775 '$filter', 1776 function ( $filter ) { 1777 return { 1778 restrict: 'EA', 1779 scope: { 1780 data: '=', 1781 filtername: '=', 1782 filtervalue: '=', 1783 width: '@', 1784 height: '@', 1785 id: '@', 1786 showlabels: '@', 1787 showlegend: '@', 1788 donutLabelsOutside: '@', 1789 pieLabelsOutside: '@', 1790 labelType: '@', 1791 nodata: '@', 1792 margin: '&', 1793 x: '&', 1794 y: '&', 1795 color: '&', 1796 donut: '@', 1797 donutRatio: '@', 1798 labelthreshold: '@', 1799 description: '&', 1800 tooltips: '@', 1801 tooltipcontent: '&', 1802 valueFormat: '&', 1803 callback: '&', 1804 legendmargin: '&', 1805 legendwidth: '@', 1806 legendheight: '@', 1807 legendkey: '@', 1808 legendcolor: '&', 1809 legendalign: '@', 1810 legendrightalign: '@', 1811 legendupdatestate: '@', 1812 legendradiobuttonmode: '@', 1813 objectequality: '@', 1814 transitionduration: '@' 1815 }, 1816 controller: [ 1817 '$scope', 1818 '$element', 1819 '$attrs', 1820 function ( $scope, $element, $attrs ) { 1821 $scope.d3Call = function ( data, chart ) { 1822 checkElementID( $scope, $attrs, $element, chart, data ); 1823 }; 1824 } 1825 ], 1826 link: function ( scope, element, attrs ) { 1827 scope.$watch( 'width + height', function () { 1828 updateDimensions( scope, attrs, element, scope.chart ); 1829 } ); 1830 scope.$watch( 'data', function ( data ) { 1831 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 1832 data = $filter( scope.filtername )( data, scope.filtervalue ); 1833 } 1834 if ( data ) { 1835 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 1836 if ( scope.chart ) { 1837 return scope.d3Call( data, scope.chart ); 1838 } 1839 nv.addGraph( { 1840 generate: function () { 1841 initializeMargin( scope, attrs ); 1842 var chart = nv.models.pieChart().x( attrs.x === undefined ? function ( d ) { 1843 return d[ 0 ]; 1844 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 1845 return d[ 1 ]; 1846 } : scope.y() ).width( scope.width ).height( scope.height ).margin( scope.margin ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ).showLabels( attrs.showlabels === undefined ? false : attrs.showlabels === 'true' ).labelThreshold( attrs.labelthreshold === undefined ? 0.02 : attrs.labelthreshold ).labelType( attrs.labeltype === undefined ? 'key' : attrs.labeltype ).pieLabelsOutside( attrs.pielabelsoutside === undefined ? true : attrs.pielabelsoutside === 'true' ).valueFormat( attrs.valueformat === undefined ? d3.format( ',.2f' ) : attrs.valueformat ).showLegend( attrs.showlegend === undefined ? false : attrs.showlegend === 'true' ).description( attrs.description === undefined ? function ( d ) { 1847 return d.description; 1848 } : scope.description() ).color( attrs.color === undefined ? nv.utils.defaultColor() : scope.color() ).donutLabelsOutside( attrs.donutlabelsoutside === undefined ? false : attrs.donutlabelsoutside === 'true' ).donut( attrs.donut === undefined ? false : attrs.donut === 'true' ).donutRatio( attrs.donutratio === undefined ? 0.5 : attrs.donutratio ); 1849 if ( attrs.tooltipcontent ) { 1850 chart.tooltipContent( scope.tooltipcontent() ); 1851 } 1852 scope.d3Call( data, chart ); 1853 nv.utils.windowResize( chart.update ); 1854 scope.chart = chart; 1855 return chart; 1856 }, 1857 callback: attrs.callback === undefined ? null : scope.callback() 1858 } ); 1859 } 1860 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 1861 } 1862 }; 1863 } 1864 ] ).directive( 'nvd3ScatterChart', [ 1865 '$filter', 1866 function ( $filter ) { 1867 return { 1868 restrict: 'EA', 1869 scope: { 1870 data: '=', 1871 filtername: '=', 1872 filtervalue: '=', 1873 width: '@', 1874 height: '@', 1875 id: '@', 1876 showlegend: '@', 1877 tooltips: '@', 1878 showcontrols: '@', 1879 showDistX: '@', 1880 showDistY: '@', 1881 rightAlignYAxis: '@', 1882 fisheye: '@', 1883 xPadding: '@', 1884 yPadding: '@', 1885 tooltipContent: '&', 1886 tooltipXContent: '&', 1887 tooltipYContent: '&', 1888 color: '&', 1889 margin: '&', 1890 nodata: '@', 1891 transitionDuration: '@', 1892 shape: '&', 1893 onlyCircles: '@', 1894 interactive: '@', 1895 x: '&', 1896 y: '&', 1897 size: '&', 1898 forceX: '@', 1899 forceY: '@', 1900 forceSize: '@', 1901 xrange: '&', 1902 xdomain: '&', 1903 xscale: '&', 1904 yrange: '&', 1905 ydomain: '&', 1906 yscale: '&', 1907 sizerange: '&', 1908 sizedomain: '&', 1909 zscale: '&', 1910 callback: '&', 1911 xaxisorient: '&', 1912 xaxisticks: '&', 1913 xaxistickvalues: '&xaxistickvalues', 1914 xaxisticksubdivide: '&', 1915 xaxisticksize: '&', 1916 xaxistickpadding: '&', 1917 xaxistickformat: '&', 1918 xaxislabel: '@', 1919 xaxisscale: '&', 1920 xaxisdomain: '&', 1921 xaxisrange: '&', 1922 xaxisrangeband: '&', 1923 xaxisrangebands: '&', 1924 xaxisshowmaxmin: '@', 1925 xaxishighlightzero: '@', 1926 xaxisrotatelabels: '@', 1927 xaxisrotateylabel: '@', 1928 xaxisstaggerlabels: '@', 1929 xaxisaxislabeldistance: '@', 1930 yaxisorient: '&', 1931 yaxisticks: '&', 1932 yaxistickvalues: '&yaxistickvalues', 1933 yaxisticksubdivide: '&', 1934 yaxisticksize: '&', 1935 yaxistickpadding: '&', 1936 yaxistickformat: '&', 1937 yaxislabel: '@', 1938 yaxisscale: '&', 1939 yaxisdomain: '&', 1940 yaxisrange: '&', 1941 yaxisrangeband: '&', 1942 yaxisrangebands: '&', 1943 yaxisshowmaxmin: '@', 1944 yaxishighlightzero: '@', 1945 yaxisrotatelabels: '@', 1946 yaxisrotateylabel: '@', 1947 yaxisstaggerlabels: '@', 1948 yaxislabeldistance: '@', 1949 legendmargin: '&', 1950 legendwidth: '@', 1951 legendheight: '@', 1952 legendkey: '@', 1953 legendcolor: '&', 1954 legendalign: '@', 1955 legendrightalign: '@', 1956 legendupdatestate: '@', 1957 legendradiobuttonmode: '@', 1958 objectequality: '@', 1959 transitionduration: '@' 1960 }, 1961 controller: [ 1962 '$scope', 1963 '$element', 1964 '$attrs',
1965 function ( $scope, $element, $attrs ) { 1966 $scope.d3Call = function ( data, chart ) { 1967 checkElementID( $scope, $attrs, $element, chart, data ); 1968 }; 1969 } 1970 ], 1971 link: function ( scope, element, attrs ) { 1972 scope.$watch( 'width + height', function () { 1973 updateDimensions( scope, attrs, element, scope.chart ); 1974 } ); 1975 scope.$watch( 'data', function ( data ) { 1976 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 1977 data = $filter( scope.filtername )( data, scope.filtervalue ); 1978 } 1979 if ( data ) { 1980 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 1981 if ( scope.chart ) { 1982 return scope.d3Call( data, scope.chart ); 1983 } 1984 nv.addGraph( { 1985 generate: function () { 1986 initializeMargin( scope, attrs ); 1987 var chart = nv.models.scatterChart().width( scope.width ).height( scope.height ).margin( scope.margin ).x( attrs.x === undefined ? function ( d ) { 1988 return d.x; 1989 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 1990 return d.y; 1991 } : scope.y() ).size( attrs.size === undefined ? function ( d ) { 1992 return d.size === undefined ? 1 : d.size; 1993 } : scope.size() ).forceX( attrs.forcex === undefined ? [] : scope.$eval( attrs.forcex ) ).forceY( attrs.forcey === undefined ? [] : scope.$eval( attrs.forcey ) ).forceSize( attrs.forcesize === undefined ? [] : scope.$eval( attrs.forcesize ) ).interactive( attrs.interactive === undefined ? false : attrs.interactive === 'true' ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).tooltipContent( attrs.tooltipContent === undefined ? null : scope.tooltipContent() ).tooltipXContent( attrs.tooltipxcontent === undefined ? function ( key, x ) { 1994 return '<strong>' + x + '</strong>'; 1995 } : scope.tooltipXContent() ).tooltipYContent( attrs.tooltipycontent === undefined ? function ( key, x, y ) { 1996 return '<strong>' + y + '</strong>'; 1997 } : scope.tooltipYContent() ).showControls( attrs.showcontrols === undefined ? false : attrs.showcontrols === 'true' ).showLegend( attrs.showlegend === undefined ? false : attrs.showlegend === 'true' ).showDistX( attrs.showdistx === undefined ? false : attrs.showdistx === 'true' ).showDistY( attrs.showdisty === undefined ? false : attrs.showdisty === 'true' ).xPadding( attrs.xpadding === undefined ? 0 : +attrs.xpadding ).yPadding( attrs.ypadding === undefined ? 0 : +attrs.ypadding ).fisheye( attrs.fisheye === undefined ? 0 : +attrs.fisheye ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ).color( attrs.color === undefined ? nv.utils.defaultColor() : scope.color() ).transitionDuration( attrs.transitionduration === undefined ? 250 : +attrs.transitionduration ); 1998 if ( attrs.shape ) { 1999 chart.scatter.onlyCircles( false ); 2000 chart.scatter.shape( attrs.shape === undefined ? function ( d ) { 2001 return d.shape || 'circle'; 2002 } : scope.shape() ); 2003 } 2004 //'pointActive', 'clipVoronoi', 'clipRadius', 'useVoronoi' 2005 if ( attrs.xdomain ) { 2006 if ( Array.isArray( scope.$eval( attrs.xdomain ) ) ) { 2007 chart.xDomain( scope.$eval( attrs.xdomain ) ); 2008 } else if ( typeof scope.xdomain() === 'function' ) { 2009 chart.xDomain( scope.xdomain() ); 2010 } 2011 } 2012 if ( attrs.ydomain ) { 2013 if ( Array.isArray( scope.$eval( attrs.ydomain ) ) ) { 2014 chart.yDomain( scope.$eval( attrs.ydomain ) ); 2015 } else if ( typeof scope.ydomain() === 'function' ) { 2016 chart.yDomain( scope.ydomain() ); 2017 } 2018 } 2019 if ( attrs.xscale ) { 2020 chart.xDomain( scope.xdomain() ); 2021 chart.xRange( scope.xrange() ); 2022 chart.xScale( scope.xscale() ); 2023 } 2024 if ( attrs.yscale ) { 2025 chart.yDomain( scope.ydomain() ); 2026 chart.yRange( scope.yrange() ); 2027 chart.yScale( scope.yscale() ); 2028 } 2029 if ( attrs.zscale ) { 2030 chart.sizeDomain( scope.sizedomain() ); 2031 chart.sizeRange( scope.sizerange() ); 2032 chart.zScale( scope.zscale() ); 2033 } 2034 scope.d3Call( data, chart ); 2035 nv.utils.windowResize( chart.update ); 2036 scope.chart = chart; 2037 return chart; 2038 }, 2039 callback: attrs.callback === undefined ? null : scope.callback() 2040 } ); 2041 } 2042 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 2043 } 2044 }; 2045 } 2046 ] ).directive( 'nvd3ScatterPlusLineChart', [ 2047 '$filter', 2048 function ( $filter ) { 2049 return { 2050 restrict: 'EA', 2051 scope: { 2052 data: '=', 2053 filtername: '=', 2054 filtervalue: '=', 2055 width: '@', 2056 height: '@', 2057 id: '@', 2058 showlegend: '@', 2059 tooltips: '@', 2060 showcontrols: '@', 2061 showDistX: '@', 2062 showDistY: '@', 2063 rightAlignYAxis: '@', 2064 fisheye: '@', 2065 tooltipContent: '&', 2066 tooltipXContent: '&', 2067 tooltipYContent: '&', 2068 color: '&', 2069 margin: '&', 2070 nodata: '@', 2071 transitionDuration: '@', 2072 shape: '&', 2073 onlyCircles: '@', 2074 interactive: '@', 2075 x: '&', 2076 y: '&', 2077 size: '&', 2078 forceX: '@', 2079 forceY: '@', 2080 forceSize: '@', 2081 xrange: '&', 2082 xdomain: '&', 2083 xscale: '&', 2084 yrange: '&', 2085 ydomain: '&', 2086 yscale: '&', 2087 sizerange: '&', 2088 sizedomain: '&', 2089 zscale: '&', 2090 callback: '&', 2091 xaxisorient: '&', 2092 xaxisticks: '&', 2093 xaxistickvalues: '&xaxistickvalues', 2094 xaxisticksubdivide: '&', 2095 xaxisticksize: '&', 2096 xaxistickpadding: '&', 2097 xaxistickformat: '&', 2098 xaxislabel: '@', 2099 xaxisscale: '&', 2100 xaxisdomain: '&', 2101 xaxisrange: '&', 2102 xaxisrangeband: '&', 2103 xaxisrangebands: '&', 2104 xaxisshowmaxmin: '@', 2105 xaxishighlightzero: '@', 2106 xaxisrotatelabels: '@', 2107 xaxisrotateylabel: '@', 2108 xaxisstaggerlabels: '@', 2109 xaxisaxislabeldistance: '@', 2110 yaxisorient: '&', 2111 yaxisticks: '&', 2112 yaxistickvalues: '&yaxistickvalues', 2113 yaxisticksubdivide: '&', 2114 yaxisticksize: '&', 2115 yaxistickpadding: '&', 2116 yaxistickformat: '&', 2117 yaxislabel: '@', 2118 yaxisscale: '&', 2119 yaxisdomain: '&', 2120 yaxisrange: '&', 2121 yaxisrangeband: '&', 2122 yaxisrangebands: '&', 2123 yaxisshowmaxmin: '@', 2124 yaxishighlightzero: '@', 2125 yaxisrotatelabels: '@', 2126 yaxisrotateylabel: '@', 2127 yaxisstaggerlabels: '@', 2128 yaxislabeldistance: '@', 2129 legendmargin: '&', 2130 legendwidth: '@', 2131 legendheight: '@', 2132 legendkey: '@', 2133 legendcolor: '&', 2134 legendalign: '@', 2135 legendrightalign: '@', 2136 legendupdatestate: '@', 2137 legendradiobuttonmode: '@', 2138 objectequality: '@', 2139 transitionduration: '@' 2140 }, 2141 controller: [ 2142 '$scope', 2143 '$element', 2144 '$attrs',
2145 function ( $scope, $element, $attrs ) { 2146 $scope.d3Call = function ( data, chart ) { 2147 checkElementID( $scope, $attrs, $element, chart, data ); 2148 }; 2149 } 2150 ], 2151 link: function ( scope, element, attrs ) { 2152 scope.$watch( 'width + height', function () { 2153 updateDimensions( scope, attrs, element, scope.chart ); 2154 } ); 2155 scope.$watch( 'data', function ( data ) { 2156 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 2157 data = $filter( scope.filtername )( data, scope.filtervalue ); 2158 } 2159 if ( data ) { 2160 if ( scope.chart ) { 2161 return scope.d3Call( data, scope.chart ); 2162 } 2163 nv.addGraph( { 2164 generate: function () { 2165 initializeMargin( scope, attrs ); 2166 var chart = nv.models.scatterPlusLineChart().width( scope.width ).height( scope.height ).margin( scope.margin ).x( attrs.x === undefined ? function ( d ) { 2167 return d.x; 2168 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 2169 return d.y; 2170 } : scope.y() ).size( attrs.size === undefined ? function ( d ) { 2171 return d.size === undefined ? 1 : d.size; 2172 } : scope.size() ).interactive( attrs.interactive === undefined ? false : attrs.interactive === 'true' ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).tooltipContent( attrs.tooltipContent === undefined ? null : scope.tooltipContent() ).tooltipXContent( attrs.tooltipxcontent === undefined ? function ( key, x ) { 2173 return '<strong>' + x + '</strong>'; 2174 } : scope.tooltipXContent() ).tooltipYContent( attrs.tooltipycontent === undefined ? function ( key, x, y ) { 2175 return '<strong>' + y + '</strong>'; 2176 } : scope.tooltipYContent() ).showControls( attrs.showcontrols === undefined ? false : attrs.showcontrols === 'true' ).showLegend( attrs.showlegend === undefined ? false : attrs.showlegend === 'true' ).showDistX( attrs.showdistx === undefined ? false : attrs.showdistx === 'true' ).showDistY( attrs.showdisty === undefined ? false : attrs.showdisty === 'true' ).fisheye( attrs.fisheye === undefined ? 0 : +attrs.fisheye ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ).color( attrs.color === undefined ? nv.utils.defaultColor() : scope.color() ).transitionDuration( attrs.transitionduration === undefined ? 250 : +attrs.transitionduration ); 2177 if ( attrs.shape ) { 2178 chart.scatter.onlyCircles( false ); 2179 chart.scatter.shape( attrs.shape === undefined ? function ( d ) { 2180 return d.shape || 'circle'; 2181 } : scope.shape() ); 2182 } 2183 scope.d3Call( data, chart ); 2184 nv.utils.windowResize( chart.update ); 2185 scope.chart = chart; 2186 return chart; 2187 }, 2188 callback: attrs.callback === undefined ? null : scope.callback() 2189 } ); 2190 } 2191 } ); 2192 } 2193 }; 2194 } 2195 ] ).directive( 'nvd3LinePlusBarChart', [ 2196 '$filter', 2197 function ( $filter ) { 2198 return { 2199 restrict: 'EA', 2200 scope: { 2201 data: '=', 2202 filtername: '=', 2203 filtervalue: '=', 2204 width: '@', 2205 height: '@', 2206 id: '@', 2207 showlegend: '@', 2208 tooltips: '@', 2209 showxaxis: '@', 2210 showyaxis: '@', 2211 forceX: '@', 2212 forceY: '@', 2213 forceY2: '@', 2214 rightalignyaxis: '@', 2215 defaultstate: '@', 2216 nodata: '@', 2217 margin: '&', 2218 tooltipcontent: '&', 2219 color: '&', 2220 x: '&', 2221 y: '&', 2222 clipvoronoi: '@', 2223 interpolate: '@', 2224 callback: '&', 2225 xaxisorient: '&', 2226 xaxisticks: '&', 2227 xaxistickvalues: '&xaxistickvalues', 2228 xaxisticksubdivide: '&', 2229 xaxisticksize: '&', 2230 xaxistickpadding: '&', 2231 xaxistickformat: '&', 2232 xaxislabel: '@', 2233 xaxisscale: '&', 2234 xaxisdomain: '&', 2235 xaxisrange: '&', 2236 xaxisrangeband: '&', 2237 xaxisrangebands: '&', 2238 xaxisshowmaxmin: '@', 2239 xaxishighlightzero: '@', 2240 xaxisrotatelabels: '@', 2241 xaxisrotateylabel: '@', 2242 xaxisstaggerlabels: '@', 2243 xaxisaxislabeldistance: '@', 2244 y1axisorient: '&', 2245 y1axisticks: '&', 2246 y1axistickvalues: '&y1axistickvalues', 2247 y1axisticksubdivide: '&', 2248 y1axisticksize: '&', 2249 y1axistickpadding: '&', 2250 y1axistickformat: '&', 2251 y1axislabel: '@', 2252 y1axisscale: '&', 2253 y1axisdomain: '&', 2254 y1axisrange: '&', 2255 y1axisrangeband: '&', 2256 y1axisrangebands: '&', 2257 y1axisshowmaxmin: '@', 2258 y1axishighlightzero: '@', 2259 y1axisrotatelabels: '@', 2260 y1axisrotateylabel: '@', 2261 y1axisstaggerlabels: '@', 2262 y1axisaxislabeldistance: '@', 2263 y2axisorient: '&', 2264 y2axisticks: '&', 2265 y2axistickvalues: '&y2axistickvalues', 2266 y2axisticksubdivide: '&', 2267 y2axisticksize: '&', 2268 y2axistickpadding: '&', 2269 y2axistickformat: '&', 2270 y2axislabel: '@', 2271 y2axisscale: '&', 2272 y2axisdomain: '&', 2273 y2axisrange: '&', 2274 y2axisrangeband: '&', 2275 y2axisrangebands: '&', 2276 y2axisshowmaxmin: '@', 2277 y2axishighlightzero: '@', 2278 y2axisrotatelabels: '@', 2279 y2axisrotateylabel: '@', 2280 y2axisstaggerlabels: '@', 2281 y2axisaxislabeldistance: '@', 2282 legendmargin: '&', 2283 legendwidth: '@', 2284 legendheight: '@', 2285 legendkey: '@', 2286 legendcolor: '&', 2287 legendalign: '@', 2288 legendrightalign: '@', 2289 legendupdatestate: '@', 2290 legendradiobuttonmode: '@', 2291 objectequality: '@', 2292 transitionduration: '@',
2293 lineinteractive: '@', 2294 barinteractive: '@' 2295 }, 2296 controller: [ 2297 '$scope', 2298 '$element', 2299 '$attrs', 2300 function ( $scope, $element, $attrs ) { 2301 $scope.d3Call = function ( data, chart ) { 2302 checkElementID( $scope, $attrs, $element, chart, data ); 2303 }; 2304 } 2305 ], 2306 link: function ( scope, element, attrs ) { 2307 scope.$watch( 'width + height', function () { 2308 updateDimensions( scope, attrs, element, scope.chart ); 2309 } ); 2310 scope.$watch( 'data', function ( data ) { 2311 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 2312 data = $filter( scope.filtername )( data, scope.filtervalue ); 2313 } 2314 if ( data ) { 2315 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 2316 if ( scope.chart ) { 2317 return scope.d3Call( data, scope.chart ); 2318 } 2319 nv.addGraph( { 2320 generate: function () { 2321 initializeMargin( scope, attrs ); 2322 var chart = nv.models.linePlusBarChart().width( scope.width ).height( scope.height ).margin( scope.margin ).x( attrs.x === undefined ? function ( d ) { 2323 return d[ 0 ]; 2324 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 2325 return d[ 1 ]; 2326 } : scope.y() ).showLegend( attrs.showlegend === undefined ? false : attrs.showlegend === 'true' ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ).interpolate( attrs.interpolate === undefined ? 'linear' : attrs.interpolate ).color( attrs.color === undefined ? nv.utils.defaultColor() : scope.color() ); 2327 if ( attrs.forcex ) { 2328 chart.lines.forceX( scope.$eval( attrs.forcex ) ); 2329 chart.bars.forceX( scope.$eval( attrs.forcex ) ); 2330 } 2331 if ( attrs.forcey ) { 2332 chart.lines.forceY( scope.$eval( attrs.forcey ) ); 2333 chart.bars.forceY( scope.$eval( attrs.forcey ) ); 2334 } 2335 if ( attrs.tooltipcontent ) { 2336 chart.tooltipContent( scope.tooltipcontent() ); 2337 } 2338 if ( attrs.lineinteractive && attrs.lineinteractive === 'false' ) { 2339 chart.lines.interactive( false ); 2340 } 2341 if ( attrs.barinteractive && attrs.barinteractive === 'false' ) { 2342 chart.bars.interactive( false ); 2343 } 2344 scope.d3Call( data, chart ); 2345 nv.utils.windowResize( chart.update ); 2346 scope.chart = chart; 2347 return chart; 2348 }, 2349 callback: attrs.callback === undefined ? null : scope.callback() 2350 } ); 2351 } 2352 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 2353 } 2354 }; 2355 } 2356 ] ).directive( 'nvd3LineWithFocusChart', [ 2357 '$filter', 2358 function ( $filter ) { 2359 return { 2360 restrict: 'EA', 2361 scope: { 2362 data: '=', 2363 filtername: '=', 2364 filtervalue: '=', 2365 width: '@', 2366 height: '@', 2367 height2: '@', 2368 id: '@', 2369 showlegend: '@', 2370 tooltips: '@', 2371 showxaxis: '@', 2372 showyaxis: '@', 2373 rightalignyaxis: '@', 2374 defaultstate: '@', 2375 nodata: '@', 2376 margin: '&', 2377 margin2: '&', 2378 tooltipcontent: '&', 2379 color: '&', 2380 x: '&', 2381 y: '&', 2382 forceX: '@', 2383 forceY: '@', 2384 clipedge: '@', 2385 clipvoronoi: '@', 2386 interpolate: '@', 2387 isArea: '@', 2388 size: '&', 2389 defined: '&', 2390 interactive: '@', 2391 callback: '&', 2392 xaxisorient: '&', 2393 xaxisticks: '&', 2394 xaxistickvalues: '&xaxistickvalues', 2395 xaxisticksubdivide: '&', 2396 xaxisticksize: '&', 2397 xaxistickpadding: '&', 2398 xaxistickformat: '&', 2399 xaxislabel: '@', 2400 xaxisscale: '&', 2401 xaxisdomain: '&', 2402 xaxisrange: '&', 2403 xaxisrangeband: '&', 2404 xaxisrangebands: '&', 2405 xaxisshowmaxmin: '@', 2406 xaxishighlightzero: '@', 2407 xaxisrotatelabels: '@', 2408 xaxisrotateylabel: '@', 2409 xaxisstaggerlabels: '@', 2410 xaxisaxislabeldistance: '@', 2411 x2axisorient: '&', 2412 x2axisticks: '&', 2413 x2axistickvalues: '&xaxistickvalues', 2414 x2axisticksubdivide: '&', 2415 x2axisticksize: '&', 2416 x2axistickpadding: '&', 2417 x2axistickformat: '&', 2418 x2axislabel: '@', 2419 x2axisscale: '&', 2420 x2axisdomain: '&', 2421 x2axisrange: '&', 2422 x2axisrangeband: '&', 2423 x2axisrangebands: '&', 2424 x2axisshowmaxmin: '@', 2425 x2axishighlightzero: '@', 2426 x2axisrotatelables: '@', 2427 x2axisrotateylabel: '@', 2428 x2axisstaggerlabels: '@', 2429 yaxisorient: '&', 2430 yaxisticks: '&', 2431 yaxistickvalues: '&yaxistickvalues', 2432 yaxisticksubdivide: '&', 2433 yaxisticksize: '&', 2434 yaxistickpadding: '&', 2435 yaxistickformat: '&', 2436 yaxislabel: '@', 2437 yaxisscale: '&', 2438 yaxisdomain: '&', 2439 yaxisrange: '&', 2440 yaxisrangeband: '&', 2441 yaxisrangebands: '&', 2442 yaxisshowmaxmin: '@', 2443 yaxishighlightzero: '@', 2444 yaxisrotatelabels: '@', 2445 yaxisrotateylabel: '@', 2446 yaxisstaggerlabels: '@', 2447 yaxislabeldistance: '@', 2448 y2axisorient: '&', 2449 y2axisticks: '&', 2450 y2axistickvalues: '&', 2451 y2axisticksubdivide: '&', 2452 y2axisticksize: '&', 2453 y2axistickpadding: '&', 2454 y2axistickformat: '&', 2455 y2axislabel: '@', 2456 y2axisscale: '&', 2457 y2axisdomain: '&', 2458 y2axisrange: '&', 2459 y2axisrangeband: '&', 2460 y2axisrangebands: '&', 2461 y2axisshowmaxmin: '@', 2462 y2axishighlightzero: '@', 2463 y2axisrotatelabels: '@', 2464 y2axisrotateylabel: '@', 2465 y2axisstaggerlabels: '@', 2466 legendmargin: '&', 2467 legendwidth: '@', 2468 legendheight: '@', 2469 legendkey: '@', 2470 legendcolor: '&', 2471 legendalign: '@', 2472 legendrightalign: '@', 2473 legendupdatestate: '@', 2474 legendradiobuttonmode: '@', 2475 objectequality: '@', 2476 transitionduration: '@' 2477 }, 2478 controller: [ 2479 '$scope', 2480 '$element', 2481 '$attrs',
2482 function ( $scope, $element, $attrs ) { 2483 $scope.d3Call = function ( data, chart ) { 2484 checkElementID( $scope, $attrs, $element, chart, data ); 2485 }; 2486 } 2487 ], 2488 link: function ( scope, element, attrs ) { 2489 scope.$watch( 'width + height', function () { 2490 updateDimensions( scope, attrs, element, scope.chart ); 2491 } ); 2492 scope.$watch( 'data', function ( data ) { 2493 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 2494 data = $filter( scope.filtername )( data, scope.filtervalue ); 2495 } 2496 if ( data ) { 2497 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 2498 if ( scope.chart ) { 2499 return scope.d3Call( data, scope.chart ); 2500 } 2501 nv.addGraph( { 2502 generate: function () { 2503 initializeMargin( scope, attrs ); 2504 //setup height 2 2505 //height 2 is 100 2506 //margin 2507 //nvd3 default is {top: 30, right: 30, bottom: 30, left: 60} 2508 //setup margin 2 2509 //nvd3 default is {top: 0, right: 30, bottom: 20, left: 60} 2510 if ( attrs.margin2 ) { 2511 var margin2 = scope.$eval( attrs.margin2 ); 2512 if ( typeof margin2 !== 'object' ) { 2513 // we were passed a vanilla int, convert to full margin object 2514 margin2 = { 2515 left: margin2, 2516 top: margin2, 2517 bottom: margin2, 2518 right: margin2 2519 }; 2520 } 2521 scope.margin2 = margin2; 2522 } else { 2523 scope.margin2 = { 2524 top: 0, 2525 right: 30, 2526 bottom: 20, 2527 left: 60 2528 }; 2529 } 2530 //'xDomain', 'yDomain', 'xRange', 'yRange', ''clipEdge', 'clipVoronoi' 2531 var chart = nv.models.lineWithFocusChart().width( scope.width ).height( scope.height ).height2( attrs.height2 === undefined ? 100 : +attrs.height2 ).margin( scope.margin ).margin2( scope.margin2 ).x( attrs.x === undefined ? function ( d ) { 2532 return d[ 0 ]; 2533 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 2534 return d[ 1 ]; 2535 } : scope.y() ).forceX( attrs.forcex === undefined ? [] : scope.$eval( attrs.forcex ) ).forceY( attrs.forcey === undefined ? [] : scope.$eval( attrs.forcey ) ).showLegend( attrs.showlegend === undefined ? false : attrs.showlegend === 'true' ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ).color( attrs.color === undefined ? nv.utils.defaultColor() : scope.color() ).isArea( attrs.isarea === undefined ? function ( d ) { 2536 return d.area; 2537 } : function () { 2538 return attrs.isarea === 'true'; 2539 } ).size( attrs.size === undefined ? function ( d ) { 2540 return d.size === undefined ? 1 : d.size; 2541 } : scope.size() ).interactive( attrs.interactive === undefined ? false : attrs.interactive === 'true' ).clipEdge( attrs.clipedge === undefined ? false : attrs.clipedge === 'true' ).clipVoronoi( attrs.clipvoronoi === undefined ? false : attrs.clipvoronoi === 'true' ).interpolate( attrs.interpolate === undefined ? 'linear' : attrs.interpolate ); 2542 if ( attrs.defined ) { 2543 chart.defined( scope.defined() ); 2544 } 2545 if ( attrs.tooltipcontent ) { 2546 chart.tooltipContent( scope.tooltipcontent() ); 2547 } 2548 scope.d3Call( data, chart ); 2549 nv.utils.windowResize( chart.update ); 2550 scope.chart = chart; 2551 return chart; 2552 }, 2553 callback: attrs.callback === undefined ? null : scope.callback() 2554 } ); 2555 } 2556 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 2557 } 2558 }; 2559 } 2560 ] ).directive( 'nvd3BulletChart', [ 2561 '$filter', 2562 function ( $filter ) { 2563 return { 2564 restrict: 'EA', 2565 scope: { 2566 data: '=', 2567 filtername: '=', 2568 filtervalue: '=', 2569 width: '@', 2570 height: '@', 2571 id: '@', 2572 margin: '&', 2573 tooltips: '@', 2574 tooltipcontent: '&', 2575 orient: '@', 2576 ranges: '&', 2577 markers: '&', 2578 measures: '&', 2579 tickformat: '&', 2580 nodata: '@', 2581 callback: '&', 2582 objectequality: '@', 2583 transitionduration: '@' 2584 }, 2585 controller: [ 2586 '$scope', 2587 '$element', 2588 '$attrs',
2589 function ( $scope, $element, $attrs ) { 2590 $scope.d3Call = function ( data, chart ) { 2591 checkElementID( $scope, $attrs, $element, chart, data ); 2592 }; 2593 } 2594 ], 2595 link: function ( scope, element, attrs ) { 2596 scope.$watch( 'width + height', function () { 2597 updateDimensions( scope, attrs, element, scope.chart ); 2598 } ); 2599 scope.$watch( 'data', function ( data ) { 2600 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 2601 data = $filter( scope.filtername )( data, scope.filtervalue ); 2602 } 2603 if ( data ) { 2604 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 2605 if ( scope.chart ) { 2606 return scope.d3Call( data, scope.chart ); 2607 } 2608 nv.addGraph( { 2609 generate: function () { 2610 initializeMargin( scope, attrs ); 2611 var chart = nv.models.bulletChart().width( scope.width ).height( scope.height ).margin( scope.margin ).orient( attrs.orient === undefined ? 'left' : attrs.orient ).tickFormat( attrs.tickformat === undefined ? null : scope.tickformat() ).tooltips( attrs.tooltips === undefined ? false : attrs.tooltips === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ); 2612 if ( attrs.tooltipcontent ) { 2613 chart.tooltipContent( scope.tooltipcontent() ); 2614 } 2615 scope.d3Call( data, chart ); 2616 nv.utils.windowResize( chart.update ); 2617 scope.chart = chart; 2618 return chart; 2619 }, 2620 callback: attrs.callback === undefined ? null : scope.callback() 2621 } ); 2622 } 2623 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 2624 } 2625 }; 2626 } 2627 ] ).directive( 'nvd3SparklineChart', [ 2628 '$filter', 2629 function ( $filter ) { 2630 return { 2631 restrict: 'EA', 2632 scope: { 2633 data: '=', 2634 filtername: '=', 2635 filtervalue: '=', 2636 width: '@', 2637 height: '@', 2638 id: '@', 2639 margin: '&', 2640 x: '&', 2641 y: '&', 2642 color: '&', 2643 xscale: '&', 2644 yscale: '&', 2645 showvalue: '@', 2646 alignvalue: '@', 2647 rightalignvalue: '@', 2648 nodata: '@', 2649 callback: '&', 2650 xtickformat: '&', 2651 ytickformat: '&', 2652 objectequality: '@', 2653 transitionduration: '@' 2654 }, 2655 controller: [ 2656 '$scope', 2657 '$element', 2658 '$attrs', 2659 function ( $scope, $element, $attrs ) { 2660 $scope.d3Call = function ( data, chart ) { 2661 checkElementID( $scope, $attrs, $element, chart, data ); 2662 }; 2663 } 2664 ], 2665 link: function ( scope, element, attrs ) { 2666 scope.$watch( 'width + height', function () { 2667 updateDimensions( scope, attrs, element, scope.chart ); 2668 } ); 2669 scope.$watch( 'data', function ( data ) { 2670 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 2671 data = $filter( scope.filtername )( data, scope.filtervalue ); 2672 } 2673 if ( data ) { 2674 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 2675 if ( scope.chart ) { 2676 return scope.d3Call( data, scope.chart ); 2677 } 2678 nv.addGraph( { 2679 generate: function () { 2680 initializeMargin( scope, attrs ); 2681 var chart = nv.models.sparklinePlus().width( scope.width ).height( scope.height ).margin( scope.margin ).x( attrs.x === undefined ? function ( d ) { 2682 return d.x; 2683 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 2684 return d.y; 2685 } : scope.y() ).xTickFormat( attrs.xtickformat === undefined ? d3.format( ',r' ) : scope.xtickformat() ).yTickFormat( attrs.ytickformat === undefined ? d3.format( ',.2f' ) : scope.ytickformat() ).color( attrs.color === undefined ? nv.utils.getColor( [ '#000' ] ) : scope.color() ).showValue( attrs.showvalue === undefined ? true : attrs.showvalue === 'true' ).alignValue( attrs.al
2685ignvalue === undefined ? true : attrs.alignvalue === 'true' ).rightAlignValue( attrs.rightalignvalue === undefined ? false : attrs.rightalignvalue === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ); 2686 if ( attrs.xScale ) { 2687 chart.xScale( scope.xScale() ); 2688 } 2689 if ( attrs.yScale ) { 2690 chart.yScale( scope.yScale() ); 2691 } 2692 scope.d3Call( data, chart ); 2693 nv.utils.windowResize( chart.update ); 2694 scope.chart = chart; 2695 return chart; 2696 }, 2697 callback: attrs.callback === undefined ? null : scope.callback() 2698 } ); 2699 } 2700 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 2701 } 2702 }; 2703 } 2704 ] ).directive( 'nvd3SparklineWithBandlinesChart', [ 2705 '$filter', 2706 function ( $filter ) { 2707 /** 2708 * http://www.perceptualedge.com/articles/visual_business_intelligence/introducing_bandlines.pdf 2709 * You need five primary facts about a set of time-series values to construct a bandline: 2710 * 1) the lowest value, 2711 * 2) the 25th percentile (i.e., the point at and below which the lowest 25% of the values reside), 2712 * 3) the median (a.k.a., the 50th percentile, the point at and below which 50% of the values reside), 2713 * 4) the 75th percentile (i.e., the point at and below which 75% of the values reside), and 2714 * 5) the highest value. 2715 */ 2716 return { 2717 restrict: 'EA', 2718 scope: { 2719 data: '=', 2720 filtername: '=', 2721 filtervalue: '=', 2722 width: '@', 2723 height: '@', 2724 id: '@', 2725 margin: '&', 2726 x: '&', 2727 y: '&', 2728 color: '&', 2729 xscale: '&', 2730 yscale: '&', 2731 showvalue: '@', 2732 alignvalue: '@', 2733 rightalignvalue: '@', 2734 nodata: '@', 2735 callback: '&', 2736 xtickformat: '&', 2737 ytickformat: '&', 2738 objectequality: '@', 2739 transitionduration: '@' 2740 }, 2741 controller: [ 2742 '$scope', 2743 '$element', 2744 '$attrs', 2745 function ( $scope, $element, $attrs ) { 2746 //expect scope to contain bandlineProperties 2747 $scope.d3Call = function ( data, chart ) { 2748 var dataAttributeChartID; 2749 //randomly generated if id attribute doesn't exist 2750 var selectedChart; 2751 var sLineSelection; 2752 var bandlineData; 2753 var bandLines; 2754 if ( !$attrs.id ) { 2755 dataAttributeChartID = 'chartid' + Math.floor( Math.random() * 1000000001 ); 2756 angular.element( $element ).attr( 'data-chartid', dataAttributeChartID ); 2757 selectedChart = d3.select( '[data-iem-chartid=' + dataAttributeChartID + '] svg' ).attr( 'height', $scope.height ).attr( 'width', $scope.width ).datum( data ); 2758 //chart.yScale()($scope.bandlineProperties.median) 2759 //var sLineSelection = d3.select('svg#' + $attrs.id + ' g.nvd3.nv-wrap.nv-sparkline'); 2760 sLineSelection = d3.select( '[data-iem-chartid=' + dataAttributeChartID + '] svg' + ' g.nvd3.nv-wrap.nv-sparkline' ); 2761 bandlineData = [ 2762 $scope.bandlineProperties.min, 2763 $scope.bandlineProperties.twentyFithPercentile, 2764 $scope.bandlineProperties.median, 2765 $scope.bandlineProperties.seventyFithPercentile, 2766 $scope.bandlineProperties.max 2767 ]; 2768 bandLines = sLineSelection.selectAll( '.nv-bandline' ).data( [ bandlineData ] ); 2769 bandLines.enter().append( 'g' ).attr( 'class', 'nv-bandline' ); 2770 selectedChart.transition().duration( $attrs.transitionduration === undefined ? 250 : +$attrs.transitionduration ).call( chart ); 2771 } else { 2772 if ( !d3.select( '#' + $attrs.id + ' svg' ) ) { 2773 d3.select( '#' + $attrs.id ).append( 'svg' ); 2774 } 2775 selectedChart = d3.select( '#' + $attrs.id + ' svg' ).attr( 'height', $scope.height ).attr( 'width', $scope.width ).datum( data ); 2776 //chart.yScale()($scope.bandlineProperties.median) 2777 sLineSelection = d3.select( 'svg#' + $attrs.id + ' g.nvd3.nv
2777-wrap.nv-sparkline' ); 2778 bandlineData = [ 2779 $scope.bandlineProperties.min, 2780 $scope.bandlineProperties.twentyFithPercentile, 2781 $scope.bandlineProperties.median, 2782 $scope.bandlineProperties.seventyFithPercentile, 2783 $scope.bandlineProperties.max 2784 ]; 2785 bandLines = sLineSelection.selectAll( '.nv-bandline' ).data( [ bandlineData ] ); 2786 bandLines.enter().append( 'g' ).attr( 'class', 'nv-bandline' ); 2787 selectedChart.transition().duration( $attrs.transitionduration === undefined ? 250 : +$attrs.transitionduration ).call( chart ); 2788 } 2789 }; 2790 } 2791 ], 2792 link: function ( scope, element, attrs ) { 2793 scope.$watch( 'width + height', function () { 2794 updateDimensions( scope, attrs, element, scope.chart ); 2795 } ); 2796 scope.$watch( 'data', function ( data ) { 2797 if ( data && angular.isDefined( scope.filtername ) && angular.isDefined( scope.filtervalue ) ) { 2798 data = $filter( scope.filtername )( data, scope.filtervalue ); 2799 } 2800 if ( data ) { 2801 //if the chart exists on the scope, do not call addGraph again, update data and call the chart. 2802 if ( scope.chart ) { 2803 return scope.d3Call( data, scope.chart ); 2804 } 2805 nv.addGraph( { 2806 generate: function () { 2807 scope.bandlineProperties = {}; 2808 var sortedValues; 2809 initializeMargin( scope, attrs ); 2810 var chart = nv.models.sparklinePlus().width( scope.width ).height( scope.height ).margin( scope.margin ).x( attrs.x === undefined ? function ( d ) { 2811 return d.x; 2812 } : scope.x() ).y( attrs.y === undefined ? function ( d ) { 2813 return d.y; 2814 } : scope.y() ).xTickFormat( attrs.xtickformat === undefined ? d3.format( ',r' ) : scope.xtickformat() ).yTickFormat( attrs.ytickformat === undefined ? d3.format( ',.2f' ) : scope.ytickformat() ).color( attrs.color === undefined ? nv.utils.getColor( [ '#000' ] ) : scope.color() ).showValue( attrs.showvalue === undefined ? true : attrs.showvalue === 'true' ).alignValue( attrs.alignvalue === undefined ? true : attrs.alignvalue === 'true' ).rightAlignValue( attrs.rightalignvalue === undefined ? false : attrs.rightalignvalue === 'true' ).noData( attrs.nodata === undefined ? 'No Data Available.' : scope.nodata ); 2815 //calc bandline data 2816 scope.bandlineProperties.min = d3.min( data, function ( d ) { 2817 return d[ 1 ]; 2818 } ); 2819 scope.bandlineProperties.max = d3.max( data, function ( d ) { 2820 return d[ 1 ]; 2821 } ); 2822 sortedValues = data.map( function ( d ) { 2823 return d[ 1 ]; 2824 } ).sort( function ( a, b ) { 2825 if ( a[ 0 ] < b[ 0 ] ) { 2826 return -1; 2827 } else if ( a[ 0 ] === b[ 0 ] ) { 2828 return 0; 2829 } else { 2830 return 1; 2831 } 2832 } ); 2833 scope.bandlineProperties.twentyFithPercentile = d3.quantile( sortedValues, 0.25 ); 2834 scope.bandlineProperties.median = d3.median( sortedValues ); 2835 scope.bandlineProperties.seventyFithPercentile = d3.quantile( sortedValues, 0.75 ); 2836 if ( attrs.xScale ) { 2837 chart.xScale( scope.xScale() ); 2838 } 2839 if ( attrs.yScale ) { 2840 chart.yScale( scope.yScale() ); 2841 } 2842 configureXaxis( chart, scope, attrs ); 2843 configureYaxis( chart, scope, attrs ); 2844 processEvents( chart, scope ); 2845 scope.d3Call( data, chart ); 2846 nv.utils.windowResize( chart.update ); 2847 scope.chart = chart; 2848 return chart; 2849 }, 2850 callback: attrs.callback === undefined ? null : scope.callback() 2851 } ); 2852 } 2853 }, attrs.objectequality === undefined ? false : attrs.objectequality === 'true' ); 2854 } 2855 }; 2856 } 2857 ] ); //still need to implement 2858 //sparkbars?? 2859 //nv.models.multiBarTimeSeriesChart 2860 //nv.models.multiChart 2861 //nv.models.scatterPlusLineChart 2862 //nv.models.linePlusBarWithFocusChart 2863 //dual y-axis chart 2864 //crossfilter using $services? 2865 2866}() );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.