|
38 | 38 |
|
39 | 39 | // Create the stub object |
40 | 40 | var dimple = { |
41 | | - version: "2.1.4", |
| 41 | + version: "2.1.5", |
42 | 42 | plot: {}, |
43 | 43 | aggregateMethod: {} |
44 | 44 | }; |
|
1925 | 1925 | }); |
1926 | 1926 | } |
1927 | 1927 | // Rotate labels, this can only be done once the formats are set |
1928 | | - if (axis.autoRotateLabel && (axis.measure === null || axis.measure === undefined)) { |
1929 | | - if (axis === firstX) { |
1930 | | - // If the gaps are narrower than the widest label display all labels horizontally |
1931 | | - widest = 0; |
1932 | | - axis.shapes.selectAll("text").each(function () { |
1933 | | - var w = this.getComputedTextLength(); |
1934 | | - widest = (w > widest ? w : widest); |
1935 | | - }); |
1936 | | - if (widest > chartWidth / axis.shapes.selectAll("text")[0].length) { |
1937 | | - rotated = true; |
1938 | | - axis.shapes.selectAll("text") |
1939 | | - .style("text-anchor", "start") |
1940 | | - .each(function () { |
1941 | | - var rec = this.getBBox(); |
1942 | | - d3.select(this) |
1943 | | - .attr("transform", "rotate(90," + rec.x + "," + (rec.y + (rec.height / 2)) + ") translate(-5, 0)"); |
1944 | | - }); |
1945 | | - } else { |
1946 | | - // For redraw operations we need to clear the transform |
1947 | | - rotated = false; |
1948 | | - axis.shapes.selectAll("text") |
1949 | | - .style("text-anchor", "middle") |
1950 | | - .attr("transform", ""); |
1951 | | - } |
1952 | | - } else if (axis.position === "x") { |
1953 | | - // If the gaps are narrower than the widest label display all labels horizontally |
1954 | | - widest = 0; |
1955 | | - axis.shapes.selectAll("text") |
1956 | | - .each(function () { |
| 1928 | + if (axis.measure === null || axis.measure === undefined) { |
| 1929 | + if (axis.autoRotateLabel) { |
| 1930 | + if (axis === firstX) { |
| 1931 | + // If the gaps are narrower than the widest label display all labels horizontally |
| 1932 | + widest = 0; |
| 1933 | + axis.shapes.selectAll("text").each(function () { |
1957 | 1934 | var w = this.getComputedTextLength(); |
1958 | 1935 | widest = (w > widest ? w : widest); |
1959 | 1936 | }); |
1960 | | - if (widest > chartWidth / axis.shapes.selectAll("text")[0].length) { |
1961 | | - rotated = true; |
| 1937 | + if (widest > chartWidth / axis.shapes.selectAll("text")[0].length) { |
| 1938 | + rotated = true; |
| 1939 | + axis.shapes.selectAll("text") |
| 1940 | + .style("text-anchor", "start") |
| 1941 | + .each(function () { |
| 1942 | + var rec = this.getBBox(); |
| 1943 | + d3.select(this) |
| 1944 | + .attr("transform", "rotate(90," + rec.x + "," + (rec.y + (rec.height / 2)) + ") translate(-5, 0)"); |
| 1945 | + }); |
| 1946 | + } else { |
| 1947 | + // For redraw operations we need to clear the transform |
| 1948 | + rotated = false; |
| 1949 | + axis.shapes.selectAll("text") |
| 1950 | + .style("text-anchor", "middle") |
| 1951 | + .attr("transform", ""); |
| 1952 | + } |
| 1953 | + } else if (axis.position === "x") { |
| 1954 | + // If the gaps are narrower than the widest label display all labels horizontally |
| 1955 | + widest = 0; |
1962 | 1956 | axis.shapes.selectAll("text") |
1963 | | - .style("text-anchor", "end") |
1964 | 1957 | .each(function () { |
1965 | | - var rec = this.getBBox(); |
1966 | | - d3.select(this) |
1967 | | - .attr("transform", "rotate(90," + (rec.x + rec.width) + "," + (rec.y + (rec.height / 2)) + ") translate(5, 0)"); |
| 1958 | + var w = this.getComputedTextLength(); |
| 1959 | + widest = (w > widest ? w : widest); |
1968 | 1960 | }); |
1969 | | - } else { |
1970 | | - // For redraw operations we need to clear the transform |
1971 | | - rotated = false; |
1972 | | - axis.shapes.selectAll("text") |
1973 | | - .style("text-anchor", "middle") |
1974 | | - .attr("transform", ""); |
| 1961 | + if (widest > chartWidth / axis.shapes.selectAll("text")[0].length) { |
| 1962 | + rotated = true; |
| 1963 | + axis.shapes.selectAll("text") |
| 1964 | + .style("text-anchor", "end") |
| 1965 | + .each(function () { |
| 1966 | + var rec = this.getBBox(); |
| 1967 | + d3.select(this) |
| 1968 | + .attr("transform", "rotate(90," + (rec.x + rec.width) + "," + (rec.y + (rec.height / 2)) + ") translate(5, 0)"); |
| 1969 | + }); |
| 1970 | + } else { |
| 1971 | + // For redraw operations we need to clear the transform |
| 1972 | + rotated = false; |
| 1973 | + axis.shapes.selectAll("text") |
| 1974 | + .style("text-anchor", "middle") |
| 1975 | + .attr("transform", ""); |
| 1976 | + } |
1975 | 1977 | } |
| 1978 | + } else { |
| 1979 | + rotated = false; |
| 1980 | + axis.shapes.selectAll("text") |
| 1981 | + .style("text-anchor", "middle") |
| 1982 | + .attr("transform", ""); |
1976 | 1983 | } |
1977 | | - } else { |
1978 | | - rotated = false; |
1979 | | - axis.shapes.selectAll("text") |
1980 | | - .style("text-anchor", "middle") |
1981 | | - .attr("transform", ""); |
1982 | 1984 | } |
1983 | 1985 | if (axis.titleShape !== null && axis.titleShape !== undefined) { |
1984 | 1986 | axis.titleShape.remove(); |
|
0 commit comments