Skip to content

Commit

Permalink
Bar chart with second y axis overlaps data series (#4150)
Browse files Browse the repository at this point in the history
  • Loading branch information
kravets-levko authored Aug 5, 2020
1 parent 6c00f7c commit eb603f6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"series": [
{
"visible": true,
"offsetgroup": "0",
"type": "bar",
"name": "a",
"x": ["x1", "x2", "x3", "x4"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"series": [
{
"visible": true,
"offsetgroup": "0",
"type": "bar",
"name": "a",
"x": ["x1", "x2", "x3", "x4"],
Expand All @@ -63,6 +64,7 @@
},
{
"visible": true,
"offsetgroup": "1",
"type": "bar",
"name": "b",
"x": ["x1", "x2", "x3", "x4"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"series": [
{
"visible": true,
"offsetgroup": "0",
"type": "bar",
"name": "a",
"x": ["x1", "x2", "x3", "x4"],
Expand All @@ -63,6 +64,7 @@
},
{
"visible": true,
"offsetgroup": "1",
"type": "bar",
"name": "b",
"x": ["x1", "x2", "x3", "x4"],
Expand Down
5 changes: 3 additions & 2 deletions viz-lib/src/visualizations/chart/plotly/prepareDefaultData.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNil, extend, each, includes, map, sortBy } from "lodash";
import { isNil, extend, each, includes, map, sortBy, toString } from "lodash";
import chooseTextColorForBackground from "@/lib/chooseTextColorForBackground";
import { ColorPaletteArray } from "@/visualizations/ColorPalette";
import { cleanNumber, normalizeValue, getSeriesAxis } from "./utils";
Expand All @@ -16,8 +16,9 @@ function getHoverInfoPattern(options) {
return result;
}

function prepareBarSeries(series, options) {
function prepareBarSeries(series, options, additionalOptions) {
series.type = "bar";
series.offsetgroup = toString(additionalOptions.index);
if (options.showDataLabels) {
series.textposition = "inside";
}
Expand Down

0 comments on commit eb603f6

Please sign in to comment.