How to use the ext/nv.d3.1.1.15b.custom.utils function in ext

To help you get started, we’ve selected a few ext examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudera / hue / desktop / core / src / desktop / js / nvd3 / nv.d3.growingMultiBar.js View on Github external
let width = 960,
    height = 500,
    x = d3v3.scale.ordinal(),
    y = d3v3.scale.linear(),
    id = Math.floor(Math.random() * 10000), //Create semi-unique ID in case user doesn't select one
    getX = function(d) {
      return d.x;
    },
    getY = function(d) {
      return d.y;
    },
    forceY = [0], // 0 is forced by default.. this makes sense for the majority of bar graphs... user can always do chart.forceY([]) to remove
    clipEdge = true,
    stacked = false,
    stackOffset = 'zero', // options include 'silhouette', 'wiggle', 'expand', 'zero', or a custom function
    color = nv.utils.defaultColor(),
    hideable = false,
    barColor = null, // adding the ability to set the color for each rather than the whole group
    disabled, // used in conjunction with barColor to communicate from multiBarHorizontalChart what series are disabled
    delay = 0,
    xDomain,
    yDomain,
    xRange,
    yRange,
    groupSpacing = 0.1,
    selectBars = null;
  const dispatch = d3v3.dispatch(
    'chartClick',
    'elementClick',
    'elementDblClick',
    'elementMouseover',
    'elementMouseout'
github cloudera / hue / desktop / core / src / desktop / js / nvd3 / nv.d3.multiBarWithBrushChart.js View on Github external
const LABELS = {
    STACKED: 'Stacked',
    GROUPED: 'Grouped',
    SELECT: 'Enable selection'
  };

  const multibar = nv.models.growingMultiBar(),
    xAxis = nv.models.axis(),
    yAxis = nv.models.axis(),
    legend = nv.models.legend(),
    controls = nv.models.legend(),
    margin = { top: 30, right: 20, bottom: 50, left: 60 };
  let brush = d3v3.svg.brush(),
    width = null,
    height = null,
    color = nv.utils.defaultColor(),
    showControls = true,
    showLegend = true,
    showXAxis = true,
    showYAxis = true,
    rightAlignYAxis = false,
    reduceXTicks = true, // if false a tick will show for every data point
    staggerLabels = false,
    rotateLabels = 0,
    tooltips = true,
    tooltip = null,
    minTickWidth = 60,
    displayValuesInLegend = false,
    tooltipContent = null,
    x, //can be accessed via chart.xScale()
    y, //can be accessed via chart.yScale()
    state = { stacked: false, selectionEnabled: false },
github cloudera / hue / desktop / core / src / desktop / js / ko / bindings / charts / chartUtils.js View on Github external
.transition()
        .duration(150)
        .each('end', () => {
          if (options.onComplete != null) {
            options.onComplete();
          }
          if (isTimeline) {
            _d3.selectAll('g.nv-x.nv-axis g text').each(function(d) {
              insertLinebreaks(_chart, d, this);
            });
          }
        })
        .call(_chart);

      let _resizeTimeout = -1;
      nv.utils.windowResize(() => {
        window.clearTimeout(_resizeTimeout);
        _resizeTimeout = window.setTimeout(() => {
          _chart.update();
        }, 200);
      });

      $(element).on('forceUpdate', () => {
        _chart.update();
      });
      _chart.lines.dispatch.on('elementClick', d => {
        if (typeof options.onClick != 'undefined') {
          huePubSub.publish('charts.state', { updating: true });
          options.onClick(d.point);
        }
      });
github cloudera / hue / desktop / core / src / desktop / js / ko / bindings / charts / ko.scatterChart.js View on Github external
_chart.yAxis.tickFormat(d3v3.format('.02f'));
          _chart.scatter.onlyCircles(true);

          const _d3 =
            $(element).find('svg').length > 0
              ? d3v3.select($(element).find('svg')[0])
              : d3v3.select($(element)[0]).append('svg');
          _d3
            .datum(_datum)
            .transition()
            .duration(150)
            .each('end', options.onComplete != null ? options.onComplete : void 0)
            .call(_chart);

          let _resizeTimeout = -1;
          nv.utils.windowResize(() => {
            window.clearTimeout(_resizeTimeout);
            _resizeTimeout = window.setTimeout(() => {
              _chart.update();
            }, 200);
          });

          $(element).on('forceUpdate', () => {
            _chart.update();
          });

          return _chart;
        });
      }
github cloudera / hue / desktop / core / src / desktop / js / ko / bindings / charts / ko.pieChart.js View on Github external
if (_options.fqs) {
              $.each(_options.fqs(), (cnt, item) => {
                if (item.id() === _options.data.widget_id && item.field() === _options.field()) {
                  _chart.selectSlices(
                    $.map(item.filter(), it => {
                      return it.value();
                    })
                  );
                }
              });
            }

            $(element).data('chart', _chart);

            let _resizeTimeout = -1;
            nv.utils.windowResize(() => {
              window.clearTimeout(_resizeTimeout);
              _resizeTimeout = window.setTimeout(() => {
                _chart.update();
              }, 200);
            });

            $(element).on('forceUpdate', () => {
              _chart.update();
            });

            $(element).height($(element).width());
            const _parentSelector =
              typeof _options.parentSelector != 'undefined'
                ? _options.parentSelector
                : '.card-widget';
            $(element)
github cloudera / hue / desktop / core / src / desktop / js / ko / bindings / charts / mapchart / ko.mapChart.js View on Github external
if (_is2d) {
          _map.legend();
        }
      }

      createDatamap(element, _options, _fills, _mapdata, _noncountries, _maphovers);

      const _parentSelector =
        typeof _options.parentSelector != 'undefined' ? _options.parentSelector : '.card-widget';

      $element.parents(_parentSelector).one('resize', () => {
        ko.bindingHandlers.mapChart.render(element, valueAccessor);
      });

      let _resizeTimeout = -1;
      nv.utils.windowResize(() => {
        window.clearTimeout(_resizeTimeout);
        _resizeTimeout = window.setTimeout(() => {
          ko.bindingHandlers.mapChart.render(element, valueAccessor);
        }, 200);
      });

      huePubSub.publish('charts.state');
    }, 50);
github cloudera / hue / desktop / core / src / desktop / js / nvd3 / nv.d3.growingMultiBar.js View on Github external
chart.barColor = function(_) {
    if (!arguments.length) {
      return barColor;
    }
    barColor = nv.utils.getColor(_);
    return chart;
  };
github cloudera / hue / desktop / core / src / desktop / js / ko / bindings / charts / ko.barChart.js View on Github external
_chart.noData(_datum.message || I18n('No Data Available.'));
      if (_chart.multibar) {
        _chart.multibar.stacked(typeof _options.stacked != 'undefined' ? _options.stacked : false);
      }
      if (numeric(_datum)) {
        _chart.xAxis.showMaxMin(false).tickFormat(d3v3.format(',0f'));
        if (_chart.multibar) {
          _chart.multibar.barColor(null);
        }
      } else {
        _chart.xAxis.tickFormat(s => {
          return s;
        });
        if (_chart.multibar) {
          if (!_isPivot) {
            _chart.multibar.barColor(nv.utils.defaultColor());
          } else {
            _chart.multibar.barColor(null);
          }
        }
      }
      window.setTimeout(() => {
        handleSelection(_chart, _options, _datum);
        const _d3 = d3v3.select($(element).find('svg')[0]);
        _d3
          .datum(_datum)
          .transition()
          .duration(150)
          .each('end', () => {
            if (_options.onComplete != null) {
              _options.onComplete();
            }
github cloudera / hue / desktop / core / src / desktop / js / nvd3 / nv.d3.multiBarWithBrushChart.js View on Github external
'xDomain',
    'yDomain',
    'xRange',
    'yRange',
    'forceX',
    'forceY',
    'clipEdge',
    'id',
    'stacked',
    'stackOffset',
    'delay',
    'barColor',
    'groupSpacing'
  );

  chart.options = nv.utils.optionsFunc.bind(chart);

  chart.margin = function(_) {
    if (!arguments.length) {
      return margin;
    }
    margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
    margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
    margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
    margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
    return chart;
  };

  chart.width = function(_) {
    if (!arguments.length) {
      return width;
    }
github cloudera / hue / desktop / core / src / desktop / js / ko / bindings / charts / chartUtils.js View on Github external
value.y = _chart.yAxis.tickFormat()(value.y);
          return value;
        });
      });
      _chart.xAxis.tickFormat(multi(_chart.xAxis));
      _chart.multibar.stacked(typeof options.stacked != 'undefined' ? options.stacked : false);
      _chart.onChartUpdate(() => {
        _d3.selectAll('g.nv-x.nv-axis g text').each(function(d) {
          insertLinebreaks(_chart, d, this);
        });
      });
    } else if (numeric(_datum)) {
      _chart.xAxis.showMaxMin(false).tickFormat(d3v3.format(',0f'));
      _chart.staggerLabels(false);
    } else if (!_isPivot) {
      _chart.multibar.barColor(nv.utils.defaultColor());
      _chart.staggerLabels(true);
    }
    if ($(element).width() < 300 && typeof _chart.showLegend != 'undefined') {
      _chart.showLegend(false);
    }
    _chart.transitionDuration(0);

    _chart.yAxis.tickFormat(d3v3.format('s'));

    $(element).data('chart', _chart);
    handleSelection(_chart, options, _datum);
    const _d3 =
      $(element).find('svg').length > 0
        ? d3v3.select($(element).find('svg')[0])
        : d3v3.select($(element)[0]).insert('svg', ':first-child');
    if ($(element).find('svg').length < 2) {