Skip to content
This repository has been archived by the owner on Jan 29, 2021. It is now read-only.

Commit

Permalink
Fix: Timeline to honour padding right property (fixes #45) (#77)
Browse files Browse the repository at this point in the history
* Update: creationhelper to use padding-right and example

* Update: contributors.md

* Update: jest

* Update: Removed unneeded line

* Update: Removed unneeded line change
  • Loading branch information
pranav300 authored and abhijit945 committed Sep 12, 2019
1 parent 9348d1b commit fd22162
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Expand Up @@ -5,9 +5,11 @@ Cerner Corporation
- Veronica Mazur [@veronimazur]
- Swati Kode [@swatikode]
- Sharath M H [@SharathAlur]
- Pranav Agarwal [@pranav300]

[@abhijit945]: https://github.com/abhijit945
[@dinesh94singh]: https://github.com/Dinesh94Singh
[@veronimazur]: https://github.com/veronimazur
[@swatikode]: https://github.com/swatikode
[@SharathAlur]: https://github.com/SharathAlur
[@pranav300]: https://github.com/pranav300
4 changes: 2 additions & 2 deletions dev/examples/controls/timeline.js
Expand Up @@ -15,8 +15,8 @@ export const renderTimelineCustomPadding = (id) => {
data.showLegend = false;
data.axis.x.show = false;
data.padding = {
left: 0,
right: 0,
left: 150,
right: 300,
top: 0,
bottom: 0
};
Expand Down
2 changes: 1 addition & 1 deletion src/main/js/controls/Timeline/helpers/creationHelpers.js
Expand Up @@ -101,7 +101,7 @@ const getXAxisYPosition = (config) =>
* @returns {number} X Axis width
*/
const getXAxisWidth = (config) =>
config.canvasWidth - config.padding.left - getXAxisYPosition(config);
config.canvasWidth - config.padding.left - config.padding.right - getXAxisYPosition(config);
/**
* X Axis label's starting position below the graph
*
Expand Down
2 changes: 1 addition & 1 deletion src/test/unit/controls/Timeline/Timeline-spec.js
Expand Up @@ -494,7 +494,7 @@ describe("Timeline", () => {
});
it("Creates defs element with height and width", () => {
const currentWidth =
constants.PADDING.left +
constants.PADDING.left + constants.PADDING.right +
(constants.PADDING.top + constants.PADDING.bottom) * 2;
const defsElement = fetchElementByClass(styles.canvas).firstChild;
expect(defsElement.nodeName).toBe("defs");
Expand Down

0 comments on commit fd22162

Please sign in to comment.