Skip to content

Commit

Permalink
Show NoData card on BarChart when no split datums came from Druid
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianmroz-allegro committed Mar 16, 2022
1 parent 25a5c91 commit 73a5bd4
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Essence } from "../../../../common/models/essence/essence";
import { FilterClause } from "../../../../common/models/filter-clause/filter-clause";
import { Stage } from "../../../../common/models/stage/stage";
import { Binary, Nullary } from "../../../../common/utils/functional/functional";
import { MessageCard } from "../../../components/message-card/message-card";
import { Scroller } from "../../../components/scroller/scroller";
import { SPLIT } from "../../../config/constants";
import { selectMainDatum } from "../../../utils/dataset/selectors/selectors";
Expand Down Expand Up @@ -49,9 +50,14 @@ interface BarChartProps {

export const BarChart: React.FunctionComponent<BarChartProps> = props => {
const { dataset, essence, stage, highlight, acceptHighlight, dropHighlight, saveHighlight } = props;
const { [SPLIT]: split, ...totals } = selectMainDatum(dataset);
const model = create(essence, dataset);

const transposedDataset = transposeDataset(dataset, model);
if (transposedDataset.length === 0) {
return <MessageCard title="No data found. Try different filters."/>;
}

const { [SPLIT]: split, ...totals } = selectMainDatum(dataset);
const data = isStacked(model) ? stackDataset(transposedDataset, model) : transposedDataset;
const seriesCount = model.series.count();
const domain = getXDomain(data, model);
Expand Down

0 comments on commit 73a5bd4

Please sign in to comment.