Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating dependencies, updating rollup config file #13

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ sets the placement of the axis. Defaults to bottom.

### .colors(callback)

sets the d3 color scale the data series in the timeline. Defaults to `d3.scale.category20()`.
sets the d3 color scale the data series in the timeline. Defaults to `d3.scaleOrdinal(d3.schemeCategory10)`.

### .colorProperty(propertyName)

Expand Down
41 changes: 19 additions & 22 deletions dist/d3-timelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-axis'), require('d3-array'), require('d3-time-format'), require('d3-time'), require('d3-scale'), require('d3-selection'), require('d3-zoom')) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-axis', 'd3-array', 'd3-time-format', 'd3-time', 'd3-scale', 'd3-selection', 'd3-zoom'], factory) :
(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3,global.d3));
}(this, function (exports,d3Axis,d3Array,d3TimeFormat,d3Time,d3Scale,d3Selection,d3Zoom) { 'use strict';
}(this, (function (exports,d3Axis,d3Array,d3TimeFormat,d3Time,d3Scale,d3Selection,d3Zoom) { 'use strict';

var timelines = function() {
var DISPLAY_TYPES = ["circle", "rect"];
Expand Down Expand Up @@ -31,7 +31,7 @@
allowZoom = true,
axisBgColor = "white",
chartData = {},
colorCycle = d3Scale.scaleOrdinal(d3Scale.schemeCategory20),
colorCycle = d3Scale.scaleOrdinal(d3Scale.schemeCategory10),
colorPropertyName = null,
display = "rect",
beginning = 0,
Expand Down Expand Up @@ -59,7 +59,9 @@
showAxisHeaderBackground = false,
showAxisNav = false,
showAxisCalendarYear = false,
xAxisClass = 'timeline-xAxis'
xAxisClass = 'timeline-xAxis',
xScale = null,
xAxis = null
;

var appendTimeAxis = function(g, xAxis, yPosition) {
Expand Down Expand Up @@ -272,10 +274,7 @@
output = days + 'd ' + output;
}
return output;
};

var xScale;
var xAxis;
}
if (orient == "bottom") {
xAxis = d3Axis.axisBottom();
} else if (orient == "top") {
Expand Down Expand Up @@ -314,7 +313,7 @@
chartData = d;
d.forEach( function(datum, index){
var data = datum.times;
data.forEach(function(d) { d.name = datum.name });
data.forEach(function(d) { d.name = datum.name; });

var hasLabel = (typeof(datum.label) != "undefined");

Expand Down Expand Up @@ -492,18 +491,16 @@
var xpos = -d3Selection.event.transform.x;
scroll(xpos, xScale);
};
};

var zoom = d3Zoom.zoom()
.scaleExtent([0, maxZoom]) // max zoom defaults to 5
.translateExtent([[0, 0], [width, 0]]) // [x0, y0], [x1, y1] don't allow translating y-axis
.on("zoom", move);

gParent
.classed("scrollable", true)
.call(zoom);

if (! allowZoom) {
}
if (allowZoom) {
Copy link
Owner

Choose a reason for hiding this comment

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

There needs to be a default zoom. The default zoom is what allows the sideways scrolling in the days_scrollable.html. Why was this change necessary?

Copy link
Author

Choose a reason for hiding this comment

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

Oh, I commented on that jon the PR thread :)

I had a problem with allowZoom. As written, it only allows zoom is allowZoom(false) is configured.
As I understand it should the the oposite, I have change it. If I am wrong, sorry about that, I guess I don't see the semantics/meaning of the allowZoom method :(

var zoom = d3Zoom.zoom()
.scaleExtent([0, maxZoom]) // max zoom defaults to 5
.translateExtent([[0, 0], [width, 0]]) // [x0, y0], [x1, y1] don't allow translating y-axis
.on("zoom", move);

gParent.classed("scrollable", true)
.call(zoom);

g.on("wheel", function() {
d3Selection.event.preventDefault();
d3Selection.event.stopImmediatePropagation();
Expand Down Expand Up @@ -603,7 +600,7 @@
function setWidth() {
if (!width && !gParentSize.width) {
try {
width = gParentItem.node().attr("width");
width = gParentItem.node().getAttribute("width");
if (!width) {
throw "width of the timeline is not set. As of Firefox 27, timeline().with(x) needs to be explicitly set in order to render";
}
Expand Down Expand Up @@ -900,4 +897,4 @@

Object.defineProperty(exports, '__esModule', { value: true });

}));
})));
2 changes: 1 addition & 1 deletion examples/days.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script>
<script src="https://d3js.org/d3.v5.min.js" charset="utf-8"></script>
<script src="../dist/d3-timelines.js"></script>

<style type="text/css">
Expand Down
2 changes: 1 addition & 1 deletion examples/days_scrollable.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script>
<script src="https://d3js.org/d3.v5.min.js" charset="utf-8"></script>
<script src="../dist/d3-timelines.js"></script>

<style type="text/css">
Expand Down
2 changes: 1 addition & 1 deletion examples/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script>
<script src="https://d3js.org/d3.v5.min.js" charset="utf-8"></script>
<script src="../dist/d3-timelines.js"></script>

<style type="text/css">
Expand Down
3 changes: 2 additions & 1 deletion examples/scrollable.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script>
<script src="https://d3js.org/d3.v5.min.js" charset="utf-8"></script>
<script src="../dist/d3-timelines.js"></script>

<style type="text/css">
Expand Down Expand Up @@ -42,6 +42,7 @@
var chart = d3.timelines()
.width(width*4)
.stack()
.allowZoom(false)
.margin({left:70, right:30, top:0, bottom:0})
.hover(function (d, i, datum) {
// d is the current rendering object
Expand Down
2 changes: 1 addition & 1 deletion examples/timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script>
<script src="https://d3js.org/d3.v5.min.js" charset="utf-8"></script>
<script src="../dist/d3-timelines.js"></script>

<style type="text/css">
Expand Down
2 changes: 1 addition & 1 deletion examples/timelineStacked.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script>
<script src="https://d3js.org/d3.v5.min.js" charset="utf-8"></script>
<script src="../dist/d3-timelines.js"></script>

<style type="text/css">
Expand Down
Loading