Skip to content

Commit

Permalink
fixes missing axis title on discover page (#10637)
Browse files Browse the repository at this point in the history
Backports PR #10615

**Commit 1:**
fix missing axis label

* Original sha: 8308c85
* Authored by ppisljar <[email protected]> on 2017-02-28T10:05:31Z
  • Loading branch information
elastic-jasper authored and ppisljar committed Mar 1, 2017
1 parent 4f49a71 commit 30f3094
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ui/public/vislib/lib/axis/axis_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function AxisConfigFactory() {
this._values.rootEl = chartConfig.get('el');

this.data = chartConfig.data;
if (this._values.type === 'category') {
if (isCategoryAxis) {
if (!this._values.values) {
this.values = this.data.xValues(chartConfig.get('orderBucketsBySum', false));
this.ordered = this.data.get('ordered');
Expand Down Expand Up @@ -124,6 +124,11 @@ export default function AxisConfigFactory() {
}
}

if (axisConfigArgs.title == null || axisConfigArgs.title.text == null) {
const label = isCategoryAxis ? 'xAxisLabel' : 'yAxisLabel';
this.set('title.text', this.data.get(label));
}

// horizontal axis with ordinal scale should have labels rotated (so we can fit more)
// unless explicitly overriden by user
if (this.isHorizontal() && this.isOrdinal()) {
Expand Down

0 comments on commit 30f3094

Please sign in to comment.