Skip to content

Commit

Permalink
Change how images are loaded in image type. Fixes #115.
Browse files Browse the repository at this point in the history
  • Loading branch information
christabor committed May 22, 2017
1 parent a8f21c1 commit 7e06213
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
7 changes: 4 additions & 3 deletions flask_jsondash/static/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ body {
*/
position: relative;
}
.dashboard-charts .widget .chart-container {
margin: 0 auto;
}
.dashboard-charts small {
font-weight: 400;
}
Expand Down Expand Up @@ -228,8 +225,12 @@ body {
color: #444;
text-shadow: 1px 1px rgba(255, 255, 255, 1);
}
.dashboard-charts .widget .chart-container {
margin: 0 auto;
}
.dashboard-charts .widget iframe,
.dashboard-charts .widget svg,
.dashboard-charts .widget .chart-container .img,
.dashboard-charts .widget .chart-centered {
margin: 0 auto;
display: block;
Expand Down
9 changes: 2 additions & 7 deletions flask_jsondash/static/js/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,16 +682,11 @@ jsondash.handlers.handleTimeline = function(container, config) {
*/
jsondash.handlers.handleImage = function(container, config) {
'use strict';
var img = container
.select('.chart-container')
.append('div')
.append('img');
var width = isNaN(config.width) ? '100%' : config.width - jsondash.config.WIDGET_MARGIN_X;
var img = container.select('.chart-container').append('img');
var height = (config.height - jsondash.config.WIDGET_MARGIN_Y) + 'px';
img.attr({
src: config.dataSource,
height: height,
width: width
height: height
});
img.classed({img: true});
// Look for callbacks potentially registered for third party code.
Expand Down

0 comments on commit 7e06213

Please sign in to comment.