Skip to content

Commit ac763f2

Browse files
committed
fix trend and number chart when no xaxis
1 parent 76bd040 commit ac763f2

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

apps/api/src/python/visualizations-v2.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ def _briefer_create_visualization(df, options):
130130
131131
def group_dataframe(df, options, y_axis, series):
132132
if not options["xAxis"]:
133+
# When no x-axis is specified, we still need to ensure the series ID column exists
134+
df[series["id"]] = df[series["column"]["name"]]
133135
return df
134136
135137
freqs = {
@@ -459,11 +461,20 @@ def _briefer_create_visualization(df, options):
459461
"datasetIndex": dataset_index,
460462
"yAxisIndex": y_index,
461463
"z": i,
462-
"encode": {
463-
"x": options["xAxis"]["name"],
464-
"y": y_name,
465-
}
466464
}
465+
466+
# Only add encode property with x axis if xAxis is defined
467+
if options["xAxis"]:
468+
serie["encode"] = {
469+
"x": options["xAxis"]["name"],
470+
"y": y_name,
471+
}
472+
else:
473+
serie["encode"] = {
474+
"x": "__default_x",
475+
"y": y_name,
476+
}
477+
467478
if chart_type == "line":
468479
serie["symbolSize"] = 6
469480

0 commit comments

Comments
 (0)