Skip to content

Commit

Permalink
Merge pull request apache#5 in DATA-PLATFORM/caravel from annotation-…
Browse files Browse the repository at this point in the history
…stacked to dev

* commit '49659d816569dd5a82430d52d3f85adfd023a173':
  fix csv button
  stop and remove pm2 entry during run_prod.sh
  Fix bar value markers
  • Loading branch information
the-dcruz committed Oct 24, 2016
2 parents a0e47a0 + 49659d8 commit ffc86fb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
12 changes: 8 additions & 4 deletions caravel/assets/visualizations/nvd3_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const nv = require('nvd3');
require('../node_modules/nvd3/build/nv.d3.min.css');
require('./nvd3_vis.css');

const minBarWidth = 15;
const animationTime = 1000;

const addTotalBarValues = function (containerId, chart, data, stacked) {
Expand Down Expand Up @@ -43,10 +42,11 @@ const addTotalBarValues = function (containerId, chart, data, stacked) {
const xPos = parseFloat(rectObj.attr('x'));
const rectWidth = parseFloat(rectObj.attr('width'));
const t = groupLabels.append('text')
.attr('x', xPos) // rough position first, fine tune later
.attr('y', yPos - 5)
.attr('x', xPos + 5) // rough position first, fine tune later
.attr('y', yPos)
.style('font-size', '10px')
.text(format(stacked ? totalStackedValues[index] : d.y))
.attr('transform', transformAttr)
.attr('transform', transformAttr + 'rotate(-45,' + xPos + ',' + yPos +')')
.attr('class', 'bar-chart-label');
const labelWidth = t.node().getBBox().width;
t.attr('x', xPos + rectWidth / 2 - labelWidth / 2); // fine tune
Expand Down Expand Up @@ -239,11 +239,15 @@ function nvd3Vis(slice) {

const barchartWidth = function () {
let bars;
let minBarWidth = 0;
if (fd.bar_stacked) {
bars = d3.max(payload.data, function (d) { return d.values.length; });
} else {
bars = d3.sum(payload.data, function (d) { return d.values.length; });
}
if (fd.show_bar_value) {
minBarWidth = 10;
}
if (bars * minBarWidth > width) {
return bars * minBarWidth;
}
Expand Down
2 changes: 1 addition & 1 deletion caravel/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def json_dumps(self, obj):
def data(self):
"""This is the data object serialized to the js layer"""
content = {
'csv_end*point': self.csv_endpoint,
'csv_endpoint': self.csv_endpoint,
'form_data': self.form_data,
'json_endpoint': self.json_endpoint,
'standalone_endpoint': self.standalone_endpoint,
Expand Down
2 changes: 2 additions & 0 deletions run_prod.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/bash
/root/node_modules/pm2/bin/pm2 stop caravel
/root/node_modules/pm2/bin/pm2 delete caravel

python setup.py develop

Expand Down

0 comments on commit ffc86fb

Please sign in to comment.