Commit 30bd75fe authored by Masayuki Tanaka's avatar Masayuki Tanaka

Add axis.x.show option - #135

parent 633ed3bf
...@@ -166,6 +166,7 @@ ...@@ -166,6 +166,7 @@
// axis // axis
var __axis_rotated = getConfig(['axis', 'rotated'], false), var __axis_rotated = getConfig(['axis', 'rotated'], false),
__axis_x_show = getConfig(['axis', 'x', 'show'], true),
__axis_x_type = getConfig(['axis', 'x', 'type'], 'indexed'), __axis_x_type = getConfig(['axis', 'x', 'type'], 'indexed'),
__axis_x_localtime = getConfig(['axis', 'x', 'localtime'], true), __axis_x_localtime = getConfig(['axis', 'x', 'localtime'], true),
__axis_x_categories = getConfig(['axis', 'x', 'categories'], []), __axis_x_categories = getConfig(['axis', 'x', 'categories'], []),
...@@ -372,7 +373,7 @@ ...@@ -372,7 +373,7 @@
//-- Sizes --// //-- Sizes --//
// TODO: configurabale // TODO: configurabale
var rotated_padding_left = 30, rotated_padding_right = 30, rotated_padding_top = 5; var rotated_padding_left = 30, rotated_padding_right = __axis_rotated && !__axis_x_show ? 0 : 30, rotated_padding_top = 5;
function updateSizes() { function updateSizes() {
var legendHeight = getLegendHeight(), legendWidth = getLegendWidth(); var legendHeight = getLegendHeight(), legendWidth = getLegendWidth();
...@@ -474,6 +475,7 @@ ...@@ -474,6 +475,7 @@
return position.isInner ? 20 + getMaxTickWidth(id) : 40 + getMaxTickWidth(id); return position.isInner ? 20 + getMaxTickWidth(id) : 40 + getMaxTickWidth(id);
} }
function getHorizontalAxisHeight(axisId) { function getHorizontalAxisHeight(axisId) {
if (axisId === 'x' && !__axis_x_show) { return 0; }
if (axisId === 'y' && !__axis_y_show) { return __legend_show && !isLegendRight ? 10 : 1; } if (axisId === 'y' && !__axis_y_show) { return __legend_show && !isLegendRight ? 10 : 1; }
if (axisId === 'y2' && !__axis_y2_show) { return rotated_padding_top; } if (axisId === 'y2' && !__axis_y2_show) { return rotated_padding_top; }
return (getAxisLabelPositionById(axisId).isInner ? 30 : 40) + (axisId === 'y2' ? -10 : 0); return (getAxisLabelPositionById(axisId).isInner ? 30 : 40) + (axisId === 'y2' ? -10 : 0);
...@@ -2524,16 +2526,18 @@ ...@@ -2524,16 +2526,18 @@
/*-- Main Region --*/ /*-- Main Region --*/
// Add Axis // Add Axis
main.append("g") if (__axis_x_show) {
.attr("class", CLASS.axisX) main.append("g")
.attr("clip-path", clipPathForXAxis) .attr("class", CLASS.axisX)
.attr("transform", translate.x) .attr("clip-path", clipPathForXAxis)
.append("text") .attr("transform", translate.x)
.attr("class", CLASS.axisXLabel) .append("text")
.attr("transform", __axis_rotated ? "rotate(-90)" : "") .attr("class", CLASS.axisXLabel)
.attr("dx", dxForXAxisLabel) .attr("transform", __axis_rotated ? "rotate(-90)" : "")
.attr("dy", dyForXAxisLabel) .attr("dx", dxForXAxisLabel)
.style("text-anchor", textAnchorForXAxisLabel); .attr("dy", dyForXAxisLabel)
.style("text-anchor", textAnchorForXAxisLabel);
}
if (__axis_y_show) { if (__axis_y_show) {
main.append("g") main.append("g")
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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