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

Fix legend on X/Y line chart #2107

Merged
merged 1 commit into from
Feb 19, 2023
Merged
Show file tree
Hide file tree
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
Fix legend on X/Y line chart
  • Loading branch information
texodus committed Feb 19, 2023
commit 3263809e178b8174bfb63a233056ff6cdb8196d3
2 changes: 1 addition & 1 deletion packages/perspective-viewer-d3fc/src/js/charts/xy-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function xyLine(container, settings) {
const symbols = symbolTypeFromGroups(settings);

let legend = null;
if (color.domain().length > 2) {
if (color.domain().length >= 2) {
legend = colorGroupLegend()
.settings(settings)
.scale(symbols)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,45 @@ utils.with_server({}, () => {
"perspective-viewer perspective-viewer-d3fc-xyline"
)
);

test.capture(
"correctly render when a bar chart has non equidistant times on a datetime axis",
async (page) => {
const config = await page.evaluate(async () => {
const viewer =
document.querySelector("perspective-viewer");
await viewer.getTable();
await viewer.restore({
plugin: "X/Y Line",
columns: ["Profit"],
group_by: ["Order Date"],
split_by: ["State"],
filter: [["State", "in", ["NY", "CA"]]],
});

return await viewer.save();
});

expect(config).toEqual({
plugin: "X/Y Line",
columns: ["Profit"],
group_by: ["Order Date"],
split_by: ["State"],
filter: [["State", "in", ["NY", "CA"]]],
aggregates: {},
sort: [],
plugin_config: {},
settings: false,
expressions: [],
theme: "Material Light",
});

return await utils.get_contents.bind(
null,
"perspective-viewer perspective-viewer-d3fc-xyline"
)(page);
}
);
},
{ reload_page: false, root: path.join(__dirname, "..", "..", "..") }
);
Expand Down
5 changes: 3 additions & 2 deletions packages/perspective-viewer-d3fc/test/results/results.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"events_perspective-config-update_event_is_fired_when_series_axis_is_changed": "a75579dc157424593d33efff7651db28",
"events_perspective-config-update_event_is_fired_when_legend_position_is_changed": "01c7817ea82ab76f2a4d9ba47f5dce7a",
"__GIT_COMMIT__": "b15e009c0d27ab1c66cdf98d6f408dfa144e8f8e",
"__GIT_COMMIT__": "bb8f0663769ade1ab2499c7fe449ed6b8348a47d",
"xyline_shows_a_grid_without_any_settings_applied": "2aba74b5e5db14953a041e7ebb544a8a",
"xyline_displays_visible_columns_": "c8bf1c32455f8f8a5210e6ba368ba3db",
"xyline_pivot_by_a_row": "6bb755705694cc8d7766c988fc98b8b4",
Expand Down Expand Up @@ -147,5 +147,6 @@
"bar-themed_sort_by_an_alpha_column": "829054c44b1e8ae512c6d353b3538425",
"bar-themed_filters_filters_by_a_numeric_column": "c9e4e2fc4e1a12aa7684e8608f46c653",
"bar-themed_filters_filters_by_an_alpha_column": "d586997539b9f76b0733efad0631749d",
"bar-themed_filters_filters_with__in__comparator": "914b15437ab74e08463987f7d0166f05"
"bar-themed_filters_filters_with__in__comparator": "914b15437ab74e08463987f7d0166f05",
"xyline_correctly_render_when_a_bar_chart_has_non_equidistant_times_on_a_datetime_axis": "f420990315751370e1237e86b4043332"
}