Commit 3035aaae authored by David Schnur's avatar David Schnur

Merge branch 'master' into 0.9-work

Conflicts:
	component.json
	flot.jquery.json
	jquery.flot.js
	jquery.flot.pie.js
	jquery.flot.resize.js
	lib/jquery.colorhelpers.js
	package.json
parents ea4bfb11 39bc058b
......@@ -542,7 +542,7 @@ You can see a timestamp like this
alert((new Date()).getTime())
```
There are different schools of thought when it comes to diplay of
There are different schools of thought when it comes to display of
timestamps. Many will want the timestamps to be displayed according to
a certain time zone, usually the time zone in which the data has been
produced. Some want the localized experience, where the timestamps are
......@@ -572,6 +572,19 @@ In Python you can get it with something like:
```python
calendar.timegm(datetime_object.timetuple()) * 1000
```
In Ruby you can get it using the `#to_i` method on the
[`Time`](http://apidock.com/ruby/Time/to_i) object. If you're using the
`active_support` gem (default for Ruby on Rails applications) `#to_i` is also
available on the `DateTime` and `ActiveSupport::TimeWithZone` objects. You
simply need to multiply the result by 1000:
```ruby
Time.now.to_i * 1000 # => 1383582043000
# ActiveSupport examples:
DateTime.now.to_i * 1000 # => 1383582043000
ActiveSupport::TimeZone.new('Asia/Shanghai').now.to_i * 1000
# => 1383582043000
```
In .NET you can get it with something like:
......@@ -1497,7 +1510,7 @@ hooks in the plugins bundled with Flot.
case a plot is overwritten by a new plot. If you're writing a
plugin that adds extra DOM elements or event handlers, you should
add a callback to clean up after you. Take a look at the section in
PLUGINS.txt for more info.
the [PLUGINS](PLUGINS.md) document for more info.
## Plugins ##
......@@ -1519,7 +1532,7 @@ from the "option" attribute of the plugin. The init function gets a
reference to the plot object created and uses this to register hooks
and add new public methods if needed.
See the PLUGINS.txt file for details on how to write a plugin. As the
See the [PLUGINS](PLUGINS.md) document for details on how to write a plugin. As the
above description hints, it's actually pretty easy.
......
......@@ -8,9 +8,8 @@ work for us, and a faster and better response.
Issues are not a way to ask general questions about Flot. If you see unexpected
behavior but are not 100% certain that it is a bug, please try posting to the
[forum](http://groups.google.com/group/flot-graphs) first, and confirm that
what you see is really a Flot problem before creating a new issue for it.
When reporting a bug, please include a working demonstration of the problem, if
what you see is really a Flot problem before creating a new issue for it. When
reporting a bug, please include a working demonstration of the problem, if
possible, or at least a clear description of the options you're using and the
environment (browser and version, jQuery version, other libraries) that you're
running under.
......@@ -21,23 +20,23 @@ love to hear them! Please submit each suggestion as a separate new issue.
If you would like to work on an existing issue, please make sure it is not
already assigned to someone else. If an issue is assigned to someone, that
person has already started working on it. So, pick unassigned issues to prevent
duplicated efforts.
duplicated effort.
### Pull Requests ###
To make merging as easy as possible, please keep these rules in mind:
1. Divide larger changes into a series of small, logical commits with
descriptive messages.
2. Format your code according to the style guidelines below.
1. Submit new features or architectural changes to the *<version>-work*
branch for the next major release. Submit bug fixes to the master branch.
3. Submit new features or architectural changes to the <version>-work branch
for the next major release. Submit bug fixes to the master branch.
2. Divide larger changes into a series of small, logical commits with
descriptive messages.
4. Rebase, if necessary, before submitting your pull request, to reduce the
3. Rebase, if necessary, before submitting your pull request, to reduce the
work we need to do to merge it.
4. Format your code according to the style guidelines below.
### Flot Style Guidelines ###
Flot follows the [jQuery Core Style Guidelines](http://docs.jquery.com/JQuery_Core_Style_Guidelines),
......@@ -45,38 +44,38 @@ with the following updates and exceptions:
#### Spacing ####
Do not add horizontal space around parameter lists, loop definitions, or
array/object indices. For example:
Use four-space indents, no tabs. Do not add horizontal space around parameter
lists, loop definitions, or array/object indices. For example:
```js
for ( var i = 0; i < data.length; i++ ) { // This block is wrong!
if ( data[ i ] > 1 ) {
data[ i ] = 2;
}
}
for (var i = 0; i < data.length; i++) { // This block is correct!
if (data[i] > 1) {
data[i] = 2;
}
}
for ( var i = 0; i < data.length; i++ ) { // This block is wrong!
if ( data[ i ] > 1 ) {
data[ i ] = 2;
}
}
for (var i = 0; i < data.length; i++) { // This block is correct!
if (data[i] > 1) {
data[i] = 2;
}
}
```
#### Comments ####
Use // for all comments except the header at the top of a file or inline
include.
Use [jsDoc](http://usejsdoc.org) comments for all file and function headers.
Use // for all inline and block comments, regardless of length.
All // comment blocks should have an empty line above *and* below them. For
example:
```js
var a = 5;
var a = 5;
// We're going to loop here
// TODO: Make this loop faster, better, stronger!
// We're going to loop here
// TODO: Make this loop faster, better, stronger!
for (var x = 0; x < 10; x++) {}
for (var x = 0; x < 10; x++) {}
```
#### Wrapping ####
......@@ -91,9 +90,9 @@ Statements containing complex logic should not be wrapped arbitrarily if they
do not exceed 80 characters. For example:
```js
if (a == 1 && // This block is wrong!
b == 2 &&
c == 3) {}
if (a == 1 && // This block is wrong!
b == 2 &&
c == 3) {}
if (a == 1 && b == 2 && c == 3) {} // This block is correct!
if (a == 1 && b == 2 && c == 3) {} // This block is correct!
```
......@@ -14,11 +14,32 @@
### Changes ###
- Added a table of contents to the API documentation.
(patch by Brian Peiris, pull request #1064)
- Added a plot.destroy method as a way to free memory when emptying the plot
placeholder and then re-using it for some other purpose.
(patch by Thodoris Greasidis, issue #1129, pull request #1130)
- Added a table of contents and PLUGINS link to the API documentation.
(patches by Brian Peiris, pull requests #1064 and #1127)
- Added Ruby code examples for time conversion.
(patch by Mike Połtyn, pull request #1182)
- Minor improvements to API.md and README.md.
(patches by Patrik Ragnarsson, pull requests #1085 and #1086)
- Updated inlined jQuery Resize to the latest version to fix errors.
(reported by Matthew Sabol and sloker, issues #997 ad #1081)
### Bug fixes ###
- Fixed an unexpected change in behavior that resulted in duplicate tick
labels when using a plugin, like flot-tickrotor, that overrode tick labels.
(patch by Mark Cote, pull request #1091)
- Fixed a regression from 0.7 where axis labels were given the wrong width,
causing them to overlap at certain scales and ignore the labelWidth option.
(patch by Benjamin Gram, pull request #1177)
- Fixed a bug where the second axis in an xaxes/yaxes array incorrectly had
its 'innermost' property set to false or undefined, even if it was on the
other side of the plot from the first axis. This resulted in the axis bar
......@@ -26,6 +47,53 @@
when the grid had a left/right border width of zero.
(reported by Teq1, fix researched by ryleyb, issue #1056)
- Fixed an error when using a placeholder that has no font-size property.
(patch by Craig Oldford, pull request #1135)
- Fixed a regression from 0.7 where nulls at the end of a series were ignored
for purposes of determing the range of the x-axis.
(reported by Munsifali Rashid, issue #1095)
- If a font size is provided, base the default lineHeight on that size rather
that the font size of the plot placeholder, which may be very different.
(reported by Daniel Hoffmann Bernardes, issue #1131, pull request #1199)
- Fix broken highlighting for right-aligned bars.
(reported by BeWiBu and Mihai Stanciu, issues #975 and #1093, with further
assistance by Eric Byers, pull request #1120)
- Prevent white circles from sometimes showing up inside of pie charts.
(reported by Pierre Dubois and Jack Klink, issues #1128 and #1073)
- Label formatting no longer breaks when a page contains multiple pie charts.
(reported by Brend Wanders, issue #1055)
- When using multiple axes on opposite sides of the plot, the innermost axis
coming later in the list no longer has its bar drawn incorrectly.
(reported by ryleyb, issue #1056)
- When removing series labels and redrawing the plot, the legend now updates
correctly even when using an external container.
(patch by Luis Silva, issue #1159, pull request #1160)
- The pie plugin no longer ignores the value of the left offset option.
(reported by melanker, issue #1136)
- Fixed a regression from 0.7, where extra padding was added unnecessarily to
sides of the plot where there was no last tick label.
(reported by sknob001, issue #1048, pull request #1200)
- Fixed incorrect tooltip behavior in the interacting example.
(patch by cleroux, issue #686, pull request #1074)
- Fixed an error in CSS color extraction with elements outside the DOM.
(patch by execjosh, pull request #1084)
- Fixed :not selector error when using jQuery without Sizzle.
(patch by Anthony Ryan, pull request #1180)
- Worked around a browser issue that caused bars to appear un-filled.
(reported by irbian, issue #915)
## Flot 0.8.1 ##
......
......@@ -107,4 +107,4 @@ examples/axes-time-zones/index.html.
[excanvas]: http://code.google.com/p/explorercanvas/
[flashcanvas]: http://code.google.com/p/flashcanvas/
[timezone-js]: https://github.com/mde/timezone-js
[olson]: ftp://ftp.iana.org/tz/
[olson]: http://ftp.iana.org/time-zones
......@@ -42,20 +42,15 @@
}
});
function showTooltip(x, y, contents) {
$("<div id='tooltip'>" + contents + "</div>").css({
position: "absolute",
display: "none",
top: y + 5,
left: x + 5,
border: "1px solid #fdd",
padding: "2px",
"background-color": "#fee",
opacity: 0.80
}).appendTo("body").fadeIn(200);
}
$("<div id='tooltip'></div>").css({
position: "absolute",
display: "none",
border: "1px solid #fdd",
padding: "2px",
"background-color": "#fee",
opacity: 0.80
}).appendTo("body");
var previousPoint = null;
$("#placeholder").bind("plothover", function (event, pos, item) {
if ($("#enablePosition:checked").length > 0) {
......@@ -65,20 +60,14 @@
if ($("#enableTooltip:checked").length > 0) {
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
$("#tooltip").remove();
var x = item.datapoint[0].toFixed(2),
var x = item.datapoint[0].toFixed(2),
y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY,
item.series.label + " of " + x + " = " + y);
}
$("#tooltip").html(item.series.label + " of " + x + " = " + y)
.css({top: item.pageY+5, left: item.pageX+5})
.fadeIn(200);
} else {
$("#tooltip").remove();
previousPoint = null;
$("#tooltip").hide();
}
}
});
......@@ -98,7 +87,6 @@
</script>
</head>
<body>
<div id="header">
<h2>Interactivity</h2>
</div>
......
This diff is collapsed.
......@@ -69,6 +69,7 @@ More detail and specific examples can be found in the included HTML file.
var canvas = null,
target = null,
options = null,
maxRadius = null,
centerLeft = null,
centerTop = null,
......@@ -294,16 +295,15 @@ More detail and specific examples can be found in the included HTML file.
} else {
centerLeft -= legendWidth / 2;
}
if (centerLeft < maxRadius) {
centerLeft = maxRadius;
} else if (centerLeft > canvasWidth - maxRadius) {
centerLeft = canvasWidth - maxRadius;
}
} else {
centerLeft += options.series.pie.offset.left;
}
if (centerLeft < maxRadius) {
centerLeft = maxRadius;
} else if (centerLeft > canvasWidth - maxRadius) {
centerLeft = canvasWidth - maxRadius;
}
var slices = plot.getData(),
attempts = 0;
......
......@@ -76,15 +76,16 @@
// if it's "transparent"
$.color.extract = function (elem, css) {
var c;
do {
c = elem.css(css).toLowerCase();
// keep going until we find an element that has color, or
// we hit the body
// we hit the body or root (have no parent)
if (c !== "" && c !== "transparent") {
break;
}
elem = elem.parent();
} while (!$.nodeName(elem.get(0), "body"));
} while (elem.length && !$.nodeName(elem.get(0), "body"));
// catch Safari's way of signalling transparent
if (c === "rgba(0, 0, 0, 0)") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment