Browse Source

Catch case where title is undefined

v3_develop
Chris Jackson 10 years ago
parent
commit
846e2b32d4
2 changed files with 5 additions and 3 deletions
  1. +0
    -1
      examples/graph2d/16_bothAxis_titles.html
  2. +5
    -2
      lib/timeline/component/DataAxis.js

+ 0
- 1
examples/graph2d/16_bothAxis_titles.html View File

@ -151,7 +151,6 @@
dataAxis: { dataAxis: {
showMinorLabels: false, showMinorLabels: false,
title: { title: {
left: false,
right: { right: {
text: 'Right (right axis)' text: 'Right (right axis)'
} }

+ 5
- 2
lib/timeline/component/DataAxis.js View File

@ -368,7 +368,10 @@ DataAxis.prototype._redrawLabels = function () {
} }
// Note that title is rotated, so we're using the height, not width! // Note that title is rotated, so we're using the height, not width!
var titleWidth = this.options.title[orientation].text === undefined ? 0 : this.props.titleCharHeight;
var titleWidth = 0;
if(this.options.title[orientation] !== undefined) {
titleWidth = this.props.titleCharHeight;
}
var offset = this.options.icons == true ? Math.max(this.options.iconWidth, titleWidth) + this.options.labelOffsetX + 15 : titleWidth + this.options.labelOffsetX + 15; var offset = this.options.icons == true ? Math.max(this.options.iconWidth, titleWidth) + this.options.labelOffsetX + 15 : titleWidth + this.options.labelOffsetX + 15;
// this will resize the yAxis to accommodate the labels. // this will resize the yAxis to accommodate the labels.
@ -470,7 +473,7 @@ DataAxis.prototype._redrawTitle = function (orientation) {
DOMutil.prepareElements(this.DOMelements.title); DOMutil.prepareElements(this.DOMelements.title);
// Check if the title is defined for this axes // Check if the title is defined for this axes
if(this.options.title[orientation] == false || this.options.title[orientation].text === undefined) {
if(this.options.title[orientation] == undefined || this.options.title[orientation].text === undefined) {
return; return;
} }
var title = DOMutil.getDOMElement('div',this.DOMelements.title, this.dom.frame); var title = DOMutil.getDOMElement('div',this.DOMelements.title, this.dom.frame);

Loading…
Cancel
Save