dosubot[bot] commented on issue #28785:
URL: https://github.com/apache/superset/issues/28785#issuecomment-2141536085
<!-- Greeting -->
Hey @msx-xt! I'm here to help you with any bugs, questions, or contributions
while you wait for a human maintainer. Let's tackle this together!
<!-- Answer -->
The discrepancy between the number of columns in your SQL query results and
the number of columns displayed in your chart is likely due to the
configuration specified in the `params` section of the chart's schema. The
`params` section lists the columns that are included in the chart:
```yaml
params:
all_columns:
- name
- global_sales
- platform
- genre
- publisher
- year
```
Only these columns will be displayed in the chart, regardless of how many
columns are returned by your SQL query. If your SQL query returns more columns
than these, the additional columns will not be displayed in the chart
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/examples/configs/charts/Video
Game Sales/Games.yaml)</sup>.
Additionally, the chart's schema in `superset/charts/schemas.py` defines how
the data is processed and displayed. The `ChartDataQueryContextSchema` and
related schemas specify the structure and fields that are used to generate the
chart data, which includes selecting specific columns and applying
post-processing operations. This ensures that only the specified columns are
included in the final chart output
<sup>[[2]](https://github.com/apache/superset/blob/master/superset/charts/schemas.py)</sup>.
Moreover, in the
`superset-frontend/plugins/plugin-chart-table/test/testData.ts` file, the
`TableChartProps` and `TableChartFormData` configurations further illustrate
how the chart properties and form data are set up. For example, the `colnames`
array specifies the columns that will be included in the chart, which may
differ from the columns returned by the SQL query
<sup>[[3]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-table/test/testData.ts)</sup>.
Furthermore, the `useResultsTableView` function in
`superset-frontend/src/components/Chart/DrillBy/useResultsTableView.tsx` shows
how the chart data is processed and displayed in a table view. The function
uses the `colnames` and `coltypes` from the `chartDataResult` to render the
table
<sup>[[4]](https://github.com/apache/superset/blob/master/superset-frontend/src/components/Chart/DrillBy/useResultsTableView.tsx)</sup>.
This configuration ensures that only the desired columns are displayed in
the final chart output.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]