Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[big num] make sure scatterplot dots align properly #2559

Merged
merged 2 commits into from
Apr 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions superset/assets/visualizations/big_number.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ function bigNumberVis(slice, payload) {
const valueExt = d3.extent(data, (d) => d[1]);
const yAxisLabelWidths = valueExt.map(value => getTextWidth(f(value), '10px Roboto'));
const yAxisMaxWidth = Math.max(...yAxisLabelWidths);
const margin = yAxisMaxWidth + (yAxisMaxWidth / 2);

let margin = yAxisMaxWidth + (yAxisMaxWidth / 2);
// make sure margin is minimum 30px, for the case when the y axix label is very small.
if (margin < 30) margin = 30;
const scaleX = d3.time.scale.utc().domain(dateExt).range([margin, width - margin]);
const scaleY = d3.scale.linear().domain(valueExt).range([height - (margin), margin]);
const colorRange = [d3.hsl(0, 1, 0.3), d3.hsl(120, 1, 0.3)];
Expand All @@ -63,7 +64,7 @@ function bigNumberVis(slice, payload) {
const line = d3.svg.line()
.x(d => scaleX(d[0]))
.y(d => scaleY(d[1]))
.interpolate('basis');
.interpolate('cardinal');

let y = height / 2;
let g = svg.append('g');
Expand Down