forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add .title() function. Closes elastic#69
- Loading branch information
Rashid Khan
committed
Mar 2, 2016
1 parent
d412cc7
commit 39bb562
Showing
5 changed files
with
75 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var $ = require('jquery'); | ||
|
||
module.exports = function appendTitle($elem, title) { | ||
var titleElem = $('.chart-title', $elem); | ||
var canvasElem = $('.chart-canvas', $elem); | ||
var titleSize = 9; | ||
|
||
if (title) { | ||
titleElem.height(titleSize); | ||
canvasElem.height($elem.height() - titleSize); | ||
titleElem.text(title); | ||
} else { | ||
titleElem.height(0); | ||
canvasElem.height($elem.height()); | ||
titleElem.text(null); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var alter = require('../lib/alter.js'); | ||
var Chainable = require('../lib/classes/chainable'); | ||
module.exports = new Chainable('title', { | ||
args: [ | ||
{ | ||
name: 'inputSeries', | ||
types: ['seriesList'] | ||
}, | ||
{ | ||
name: 'title', | ||
types: ['string', 'null'], | ||
help: 'Title for the plot.' | ||
} | ||
], | ||
help: 'Adds a title to the top of the plot. If called on more than 1 seriesList the last call will be used.', | ||
fn: function hideFn(args) { | ||
return alter(args, function (eachSeries, title) { | ||
eachSeries._title = title; | ||
return eachSeries; | ||
}); | ||
} | ||
}); |