|
1620 | 1620 | return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16); |
1621 | 1621 | } |
1622 | 1622 | function d3_rgb_parse(format, rgb, hsl) { |
1623 | | - var r = 0, g = 0, b = 0, m1, m2, name; |
| 1623 | + var r = 0, g = 0, b = 0, value, m1, m2, name; |
1624 | 1624 | m1 = /([a-z]+)\((.*)\)/i.exec(format); |
1625 | 1625 | if (m1) { |
1626 | 1626 | m2 = m1[2].split(","); |
|
1638 | 1638 | } |
1639 | 1639 | if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b); |
1640 | 1640 | if (format != null && format.charAt(0) === "#") { |
1641 | | - if (format.length === 4) { |
1642 | | - r = format.charAt(1); |
1643 | | - r += r; |
1644 | | - g = format.charAt(2); |
1645 | | - g += g; |
1646 | | - b = format.charAt(3); |
1647 | | - b += b; |
1648 | | - } else if (format.length === 7) { |
1649 | | - r = format.substring(1, 3); |
1650 | | - g = format.substring(3, 5); |
1651 | | - b = format.substring(5, 7); |
1652 | | - } |
1653 | | - r = parseInt(r, 16); |
1654 | | - g = parseInt(g, 16); |
1655 | | - b = parseInt(b, 16); |
| 1641 | + value = parseInt(format.substring(1), 16); |
| 1642 | + if (!isNaN(value)) { |
| 1643 | + if (format.length === 4) { |
| 1644 | + r = (value & 3840) >> 4; |
| 1645 | + r = r >> 4 | r; |
| 1646 | + g = value & 240; |
| 1647 | + g = g >> 4 | g; |
| 1648 | + b = value & 15; |
| 1649 | + b = b << 4 | b; |
| 1650 | + } else if (format.length === 7) { |
| 1651 | + r = (value & 16711680) >> 16; |
| 1652 | + g = (value & 65280) >> 8; |
| 1653 | + b = value & 255; |
| 1654 | + } |
| 1655 | + } |
1656 | 1656 | } |
1657 | 1657 | return rgb(r, g, b); |
1658 | 1658 | } |
|
9219 | 9219 | } ], [ "%Y", d3_true ] ]); |
9220 | 9220 | var d3_time_scaleMilliseconds = { |
9221 | 9221 | range: function(start, stop, step) { |
9222 | | - return d3.range(+start, +stop, step).map(d3_time_scaleDate); |
| 9222 | + return d3.range(Math.ceil(start / step) * step, +stop, step).map(d3_time_scaleDate); |
9223 | 9223 | }, |
9224 | 9224 | floor: d3_identity, |
9225 | 9225 | ceil: d3_identity |
|
0 commit comments