Skip to content

Commit

Permalink
fixed browserify for bower & npm
Browse files Browse the repository at this point in the history
cherry-picking @vprus's fix from master (#702/#704)
tests are still massively broken and won't be fixed!
  • Loading branch information
gordonwoodhull committed Dec 20, 2014
1 parent e9d9800 commit af788e5
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 48 deletions.
21 changes: 14 additions & 7 deletions dc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* dc 1.7.2
* dc 1.7.3
* http://dc-js.github.io/dc.js/
* Copyright 2012 Nick Zhu and other contributors
*
Expand All @@ -20,7 +20,7 @@
'use strict';

/**
#### Version 1.7.2
#### Version 1.7.3
The entire dc.js library is scoped under **dc** name space. It does not introduce anything else into the global
name space.
Expand Down Expand Up @@ -57,7 +57,7 @@ The API references will highlight the fact if a particular function is not chain
**/
var dc = {
version: "1.7.2",
version: "1.7.3",
constants: {
CHART_CLASS: "dc-chart",
DEBUG_GROUP_CLASS: "debug",
Expand Down Expand Up @@ -5402,10 +5402,17 @@ return dc;}
if(typeof define === "function" && define.amd) {
define(["d3", "crossfilter"], _dc);
} else if(typeof module === "object" && module.exports) {
// When using window global, window.crossfilter is a function
// When using require, the value will be an object with 'crossfilter'
// field, so we need to access it here.
module.exports = _dc(require('d3'), require('crossfilter').crossfilter);
var _d3 = require('d3');
var _crossfilter = require('crossfilter');
// When using npm + browserify, 'crossfilter' is a function,
// since package.json specifies index.js as main function, and it
// does special handling. When using bower + browserify,
// there's no main in bower.json (in fact, there's no bower.json),
// so we need to fix it.
if (typeof _crossfilter !== "function") {
_crossfilter = _crossfilter.crossfilter;
}
module.exports = _dc(_d3, _crossfilter);
} else {
this.dc = _dc(d3, crossfilter);
}
Expand Down
4 changes: 2 additions & 2 deletions dc.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dc.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dc",
"filename": "dc.min.js",
"version": "1.7.2",
"version": "1.7.3",
"license": "Apache-2.0",
"copyright": "2014",
"description": "A multi-dimensional charting library built to work natively with crossfilter and rendered using d3.js ",
Expand Down
60 changes: 30 additions & 30 deletions web/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
</style>
</head>
<body>
<h4 id="version-1-7-2">Version 1.7.2</h4>
<h4 id="version-1-7-3">Version 1.7.3</h4>
<p>The entire dc.js library is scoped under <strong>dc</strong> name space. It does not introduce anything else into the global
name space.</p>
<ul>
Expand Down Expand Up @@ -203,16 +203,16 @@ <h4 id="-select-selector-">.select(selector)</h4>
<p>Execute in scope d3 single selection using the given selector and return d3 selection result. Roughly the same as:</p>
<pre><code class="lang-js">d3.<span class="operator"><span class="keyword">select</span>(<span class="string">"#chart-id"</span>).<span class="keyword">select</span>(selector);</span></code></pre>
<p>This function is <strong>not chainable</strong> since it does not return a chart instance; however the d3 selection result is chainable
from d3s perspective.</p>
from d3&#39;s perspective.</p>
<h4 id="-selectall-selector-">.selectAll(selector)</h4>
<p>Execute in scope d3 selectAll using the given selector and return d3 selection result. Roughly the same as:</p>
<pre><code class="lang-js">d3<span class="variable">.select</span>(<span class="string">"#chart-id"</span>)<span class="variable">.selectAll</span>(<span class="keyword">selector</span>);</code></pre>
<p>This function is <strong>not chainable</strong> since it does not return a chart instance; however the d3 selection result is
chainable from d3s perspective.</p>
chainable from d3&#39;s perspective.</p>
<h4 id="-anchor-anchorchart-anchorselector-chartgroup-">.anchor([anchorChart/anchorSelector], [chartGroup])</h4>
<p>Set the svg root to either be an existing charts root or the first element returned from a d3 css string selector. Optionally registers the chart within the chartGroup. This class is called internally on chart initialization, but be called again to relocate the chart. However, it will orphan any previously created SVG elements.</p>
<p>Set the svg root to either be an existing chart&#39;s root or the first element returned from a d3 css string selector. Optionally registers the chart within the chartGroup. This class is called internally on chart initialization, but be called again to relocate the chart. However, it will orphan any previously created SVG elements.</p>
<h4 id="-anchorname-">.anchorName()</h4>
<p>Return the dom ID for charts anchored location</p>
<p>Return the dom ID for chart&#39;s anchored location</p>
<h4 id="-root-rootelement-">.root([rootElement])</h4>
<p>Returns the root element where a chart resides. Usually it will be the parent div element where svg was created. You
can also pass in a new root element however this is usually handled as part of the dc internal. Resetting root element
Expand All @@ -222,16 +222,16 @@ <h4 id="-svg-svgelement-">.svg([svgElement])</h4>
handled as part of the dc internal. Resetting svg element on a chart outside of dc internal might have unexpected
consequences.</p>
<h4 id="-resetsvg-">.resetSvg()</h4>
<p>Remove the charts SVG elements from the dom and recreate the container SVG element.</p>
<p>Remove the chart&#39;s SVG elements from the dom and recreate the container SVG element.</p>
<h4 id="-filterprinter-filterprinterfunction-">.filterPrinter([filterPrinterFunction])</h4>
<p>Set or get filter printer function. Filter printer function is used to generate human friendly text for filter value(s)
associated with the chart instance. By default dc charts shipped with a default filter printer implementation dc.printers.filter
that provides simple printing support for both single value and ranged filters.</p>
<h4 id="-turnoncontrols-turnoffcontrols-">.turnOnControls() &amp; .turnOffControls()</h4>
<p>Turn on/off optional control elements within the root element. dc.js currently support the following html control elements.</p>
<ul>
<li>root.selectAll(.reset) elements are turned on if the chart has an active filter. This type of control elements are usually used to store reset link to allow user to reset filter on a certain chart. This element will be turned off automatically if the filter is cleared.</li>
<li>root.selectAll(.filter) elements are turned on if the chart has an active filter. The text content of this element is then replaced with the current filter value using the filter printer function. This type of element will be turned off automatically if the filter is cleared.</li>
<li>root.selectAll(&quot;.reset&quot;) elements are turned on if the chart has an active filter. This type of control elements are usually used to store reset link to allow user to reset filter on a certain chart. This element will be turned off automatically if the filter is cleared.</li>
<li>root.selectAll(&quot;.filter&quot;) elements are turned on if the chart has an active filter. The text content of this element is then replaced with the current filter value using the filter printer function. This type of element will be turned off automatically if the filter is cleared.</li>
</ul>
<h4 id="-transitionduration-duration-">.transitionDuration([duration])</h4>
<p>Set or get animation transition duration(in milliseconds) for specific chart instance. Default duration is 750ms.</p>
Expand All @@ -243,7 +243,7 @@ <h4 id="-redraw-">.redraw()</h4>
<p>Calling redraw will cause the chart to re-render delta in data change incrementally. If there is no change in the
underlying data dimension then calling this method will have no effect on the chart. Most of the chart interaction in
dc library will automatically trigger this method through its internal event engine, therefore you only need to manually
invoke this function if data is manipulated outside of dcs control; for example if data is loaded on a periodic basis
invoke this function if data is manipulated outside of dc&#39;s control; for example if data is loaded on a periodic basis
in the background using crossfilter.add().</p>
<h4 id="-hasfilter-filter-">.hasFilter([filter])</h4>
<p>Check whether is any active filter or a specific filter is associated with particular chart instance.
Expand All @@ -256,7 +256,7 @@ <h4 id="-filter-filtervalue-">.filter([filterValue])</h4>
chart<span class="variable">.filter</span>(<span class="number">18</span>);</code></pre>
<h4 id="-filters-">.filters()</h4>
<p>Return all current filters. This method does not perform defensive cloning of the internal filter array before returning
therefore any modification of returned array will affact charts internal filter storage.</p>
therefore any modification of returned array will affact chart&#39;s internal filter storage.</p>
<h4 id="-filterhandler-function-">.filterHandler([function])</h4>
<p>Set or get filter handler. Filter handler is a function that performs the filter action on a specific dimension. Using
custom filter handler give you the flexibility to perform additional logic before or after filtering.</p>
Expand Down Expand Up @@ -338,17 +338,17 @@ <h4 id="-legend-dc-legend-">.legend([dc.legend])</h4>
<pre><code class="lang-js">chart<span class="variable">.legend</span>(dc<span class="variable">.legend</span>()<span class="variable">.x</span>(<span class="number">400</span>)<span class="variable">.y</span>(<span class="number">10</span>)<span class="variable">.itemHeight</span>(<span class="number">13</span>)<span class="variable">.gap</span>(<span class="number">5</span>))</code></pre>
<h2 id="-a-name-listeners-href-listeners-a-listeners"><a name="listeners" href="#listeners">#</a> Listeners</h2>
<p>All dc chart instance supports the following listeners.</p>
<h4 id="-on-prerender-function-chart-">.on(preRender, function(chart){})</h4>
<h4 id="-on-prerender-function-chart-">.on(&quot;preRender&quot;, function(chart){...})</h4>
<p>This listener function will be invoked before chart rendering.</p>
<h4 id="-on-postrender-function-chart-">.on(postRender, function(chart){})</h4>
<p>This listener function will be invoked after chart finish rendering including all renderlets logic.</p>
<h4 id="-on-preredraw-function-chart-">.on(preRedraw, function(chart){})</h4>
<h4 id="-on-postrender-function-chart-">.on(&quot;postRender&quot;, function(chart){...})</h4>
<p>This listener function will be invoked after chart finish rendering including all renderlets&#39; logic.</p>
<h4 id="-on-preredraw-function-chart-">.on(&quot;preRedraw&quot;, function(chart){...})</h4>
<p>This listener function will be invoked before chart redrawing.</p>
<h4 id="-on-postredraw-function-chart-">.on(postRedraw, function(chart){})</h4>
<p>This listener function will be invoked after chart finish redrawing including all renderlets logic.</p>
<h4 id="-on-filtered-function-chart-filter-">.on(filtered, function(chart, filter){})</h4>
<h4 id="-on-postredraw-function-chart-">.on(&quot;postRedraw&quot;, function(chart){...})</h4>
<p>This listener function will be invoked after chart finish redrawing including all renderlets&#39; logic.</p>
<h4 id="-on-filtered-function-chart-filter-">.on(&quot;filtered&quot;, function(chart, filter){...})</h4>
<p>This listener function will be invoked after a filter is applied, added or removed.</p>
<h4 id="-on-zoomed-function-chart-filter-">.on(zoomed, function(chart, filter){})</h4>
<h4 id="-on-zoomed-function-chart-filter-">.on(&quot;zoomed&quot;, function(chart, filter){...})</h4>
<p>This listener function will be invoked after a zoom is triggered.</p>
<h2 id="-a-name-marginable-href-marginable-a-marginable"><a name="marginable" href="#marginable">#</a> Marginable</h2>
<p>Marginable is a mixin that provides margin utility functions for both the Row Chart and Coordinate Grid Charts.</p>
Expand Down Expand Up @@ -426,7 +426,7 @@ <h4 id="-xaxispadding-padding-">.xAxisPadding([padding])</h4>
<p>Set or get x axis padding when elastic x axis is turned on. The padding will be added to both end of the x axis if and
only if elasticX is turned on otherwise it will be simply ignored.</p>
<ul>
<li>padding - could be integer or percentage in string (e.g. 10%). Padding can be applied to number or date.
<li>padding - could be integer or percentage in string (e.g. &quot;10%&quot;). Padding can be applied to number or date.
When padding with date, integer represents number of days being padded while percentage string will be treated
as number.</li>
</ul>
Expand All @@ -453,7 +453,7 @@ <h4 id="-yaxispadding-padding-">.yAxisPadding([padding])</h4>
<p>Set or get y axis padding when elastic y axis is turned on. The padding will be added to the top of the y axis if and only
if elasticY is turned on otherwise it will be simply ignored.</p>
<ul>
<li>padding - could be integer or percentage in string (e.g. 10%). Padding can be applied to number or date.
<li>padding - could be integer or percentage in string (e.g. &quot;10%&quot;). Padding can be applied to number or date.
When padding with date, integer represents number of days being padded while percentage string will be treated
as number.</li>
</ul>
Expand All @@ -471,7 +471,7 @@ <h4 id="-brushon-boolean-">.brushOn([boolean])</h4>
<p>Turn on/off the brush based in-place range filter. When the brush is on then user will be able to simply drag the mouse
across the chart to perform range filtering based on the extend of the brush. However turning on brush filter will essentially
disable other interactive elements on the chart such as the highlighting, tool-tip, and reference lines on a chart. Default
value is true.</p>
value is &quot;true&quot;.</p>
<h4 id="-focus-range-">.focus([range])</h4>
<p>Zoom this chart to focus on the given range. The given range should be an array containing only 2 element([start, end]) defining an range in x domain. If the range is not given or set to null, then the zoom will be reset. <em>For focus to work elasticX has to be turned off otherwise focus will be ignored.</em></p>
<pre><code class="lang-js">chart.renderlet(function(chart){
Expand Down Expand Up @@ -528,13 +528,13 @@ <h4 id="-stack-group-name-retriever-">.stack(group[, name, retriever])</h4>
<h2 id="-a-name-abstract-bubble-chart-href-abstract-bubble-chart-a-abstract-bubble-chart-abstract-color-chart-color-chart-"><a name="abstract-bubble-chart" href="#abstract-bubble-chart">#</a> Abstract Bubble Chart [Abstract] &lt; <a href="#color-chart">Color Chart</a></h2>
<p>An abstraction provides reusable functionalities for any chart that needs to visualize data using bubbles.</p>
<h4 id="-r-bubbleradiusscale-">.r([bubbleRadiusScale])</h4>
<p>Get or set bubble radius scale. By default bubble chart uses <code>d3.scale.linear().domain([0, 100])</code> as its r scale .</p>
<p>Get or set bubble radius scale. By default bubble chart uses <code>d3.scale.linear().domain([0, 100])</code> as it&#39;s r scale .</p>
<h4 id="-radiusvalueaccessor-radiusvalueaccessor-">.radiusValueAccessor([radiusValueAccessor])</h4>
<p>Get or set the radius value accessor function. The radius value accessor function if set will be used to retrieve data value
for each and every bubble rendered. The data retrieved then will be mapped using r scale to be used as the actual bubble
radius. In other words, this allows you to encode a data dimension using bubble size.</p>
<h4 id="-minradiuswithlabel-radius-">.minRadiusWithLabel([radius])</h4>
<p>Get or set the minimum radius for label rendering. If a bubbles radius is less than this value then no label will be rendered.
<p>Get or set the minimum radius for label rendering. If a bubble&#39;s radius is less than this value then no label will be rendered.
Default value: 10.</p>
<h4 id="-maxbubblerelativesize-relativesize-">.maxBubbleRelativeSize([relativeSize])</h4>
<p>Get or set the maximum relative size of a bubble to the length of x axis. This value is useful when the radius differences among
Expand Down Expand Up @@ -643,8 +643,8 @@ <h2 id="-a-name-data-count-href-data-count-a-data-count-widget-concrete-base-cha
by the current filters. Once created data count widget will automatically update the text content of the following elements
under the parent element.</p>
<ul>
<li>.total-count - total number of records</li>
<li>.filter-count - number of records matched by the current filters</li>
<li>&quot;.total-count&quot; - total number of records</li>
<li>&quot;.filter-count&quot; - number of records matched by the current filters</li>
</ul>
<p>Examples:</p>
<ul>
Expand Down Expand Up @@ -826,7 +826,7 @@ <h4 id="-overlaygeojson-json-name-keyaccessor-mandatory-">.overlayGeoJson(json,
<ul>
<li>json - GeoJson feed</li>
<li>name - name of the layer</li>
<li>keyAccessor - accessor function used to extract key from the GeoJson data. Key extracted by this function should match
<li>keyAccessor - accessor function used to extract &quot;key&quot; from the GeoJson data. Key extracted by this function should match
the keys generated in crossfilter groups.</li>
</ul>
<pre><code class="lang-js"><span class="comment">// insert a layer for rendering US states</span>
Expand All @@ -837,8 +837,8 @@ <h4 id="-projection-projection-">.projection(projection)</h4>
<p>Set custom geo projection function. Available <a href="https://github.com/mbostock/d3/wiki/Geo-Projections">d3 geo projection functions</a>.
Default value: albersUsa.</p>
<h4 id="-geojsons-">.geoJsons()</h4>
<p>Return all GeoJson layers currently registered with thit chart. The returned array is a reference to this charts internal
registration data structure without copying thus any modification to this array will also modify this charts internal
<p>Return all GeoJson layers currently registered with thit chart. The returned array is a reference to this chart&#39;s internal
registration data structure without copying thus any modification to this array will also modify this chart&#39;s internal
registration.</p>
<p>Return:
An array of objects containing fields {name, data, accessor}</p>
Expand All @@ -848,7 +848,7 @@ <h4 id="-removegeojson-name-">.removeGeoJson(name)</h4>
<h2 id="-a-name-bubble-overlay-chart-href-bubble-overlay-chart-a-bubble-overlay-chart-concrete-abstract-bubble-chart-abstract-bubble-chart-base-chart-base-chart-"><a name="bubble-overlay-chart" href="#bubble-overlay-chart">#</a> Bubble Overlay Chart [Concrete] &lt; <a href="#abstract-bubble-chart">Abstract Bubble Chart</a> &lt; <a href="#base-chart">Base Chart</a></h2>
<p>Bubble overlay chart is quite different from the typical bubble chart. With bubble overlay chart you can arbitrarily place
a finite number of bubbles on an existing svg or bitmap image (overlay on top of it), thus losing the typical x and y
positioning that we are used to whiling retaining the capability to visualize data using its bubble radius and
positioning that we are used to whiling retaining the capability to visualize data using it&#39;s bubble radius and
coloring.</p>
<p>Examples:</p>
<ul>
Expand Down Expand Up @@ -877,7 +877,7 @@ <h4 id="-svg-imageelement-mandatory-">.svg(imageElement) - <strong>mandatory</st
<pre><code class="lang-js">// <span class="keyword">set</span> up underlying svg element
chart<span class="preprocessor">.svg</span>(d3<span class="preprocessor">.select</span>(<span class="string">"#chart svg"</span>))<span class="comment">;</span></code></pre>
<h4 id="-point-name-x-y-mandatory-">.point(name, x, y) - <strong>mandatory</strong></h4>
<p>Set up a data point on the overlay. The name of a data point should match a specific key among data groups generated using keyAccessor.
<p>Set up a data point on the overlay. The name of a data point should match a specific &quot;key&quot; among data groups generated using keyAccessor.
If a match is found (point name &lt;-&gt; data group key) then a bubble will be automatically generated at the position specified by the
function. x and y value specified here are relative to the underlying svg.</p>
<h2 id="-a-name-row-chart-href-row-chart-a-row-chart-concrete-color-chart-color-chart-base-chart-base-chart-"><a name="row-chart" href="#row-chart">#</a> Row Chart [Concrete] &lt; <a href="#color-chart">Color Chart</a> &lt; <a href="#base-chart">Base Chart</a></h2>
Expand Down
Loading

3 comments on commit af788e5

@vprus
Copy link
Contributor

@vprus vprus commented on af788e5 Sep 16, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gordonwoodhull
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an old commit. The tests failed because I had to update the 1.7.* branch in order to add the .map file, and the tests are permanently broken on that branch. Has nothing to do with browserify support.

@vprus
Copy link
Contributor

@vprus vprus commented on af788e5 Sep 16, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.