Skip to content

Conversation

@ktx-vaidehi
Copy link
Collaborator

@ktx-vaidehi ktx-vaidehi commented Dec 11, 2025

@ktx-vaidehi ktx-vaidehi force-pushed the feat/dashboard/custom-chart-with-examples branch from 944a65b to 23c5314 Compare December 11, 2025 10:25
@github-actions
Copy link
Contributor

Failed to generate code suggestions for PR

@ktx-vaidehi ktx-vaidehi force-pushed the feat/dashboard/custom-chart-with-examples branch 4 times, most recently from eab0d14 to 228e999 Compare December 13, 2025 17:16
@ktx-vaidehi ktx-vaidehi marked this pull request as ready for review December 14, 2025 10:24
@github-actions
Copy link
Contributor

Failed to generate code suggestions for PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 14, 2025

Greptile Overview

Greptile Summary

This PR significantly enhances OpenObserve's dashboard custom chart functionality by introducing a comprehensive template library with 25 pre-built chart examples. The enhancement includes a new visual chart selector interface that allows users to browse chart categories (Line, Bar, Pie, Scatter, Radar, 3D, etc.), preview chart types with images, and apply templates that include both example SQL queries and corresponding ECharts JavaScript code. The implementation adds internationalization support across 11 languages, introduces a dynamic template loading system for performance optimization, and includes a confirmation dialog to prevent accidental loss of existing chart code. The enhancement transforms custom chart creation from requiring deep ECharts knowledge to a user-friendly template selection process.

Important Files Changed

Filename Score Overview
web/src/components/dashboards/addPanel/customChartExamples/CustomChartTypeSelector.vue 4/5 New component providing visual chart template selector with category navigation, search functionality, and confirmation dialogs
web/src/components/dashboards/addPanel/customChartExamples/customChartExampleTypes.ts 4/5 Defines TypeScript interfaces and data structure for 13 chart categories with 25 chart examples including preview image paths
web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates.ts 4/5 Implements dynamic template loading system with lazy imports for 22 different chart types and proper error handling
web/src/views/Dashboards/addPanel/AddPanel.vue 4/5 Integrates chart template selector with existing dashboard panel creation workflow and template application logic
web/src/components/dashboards/addPanel/CustomChartEditor.vue 5/5 Adds watcher to synchronize prop changes with internal editor state for proper template application
web/src/components/dashboards/panels/CustomChartRenderer.vue 4/5 Enhances chart rendering with reuse optimization, improved error handling, and formatting fixes
web/src/components/dashboards/addPanel/customChartExamples/CustomChartConfirmDialog.vue 4/5 New specialized confirmation dialog for template selection with query replacement checkbox functionality
web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates/graph.ts 5/5 Template for force-directed graph visualization with node-link data transformation for network diagrams
web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates/scatter3dDataset.ts 4/5 3D scatter plot template demonstrating multi-dimensional data visualization with configurable axis mapping
web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates/datasetSeriesLayout.ts 3/5 Complex template for dual-grid bar chart layout with dataset-driven series configuration and potential runtime issues
web/src/locales/languages/fr.json 5/5 Added French translations for custom chart type selector interface elements
web/src/locales/languages/de.json 5/5 Added German translations for custom chart type selector interface elements
web/src/locales/languages/pt.json 5/5 Added Portuguese translations for custom chart type selector interface elements
web/src/locales/languages/zh.json 5/5 Added Chinese translations for custom chart type selector interface elements
web/src/locales/languages/nl.json 5/5 Added Dutch translations for custom chart type selector interface elements
web/src/locales/languages/ja.json 5/5 Added Japanese translations for custom chart type selector interface elements
web/src/locales/languages/ko.json 5/5 Added Korean translations for custom chart type selector interface elements
web/src/locales/languages/tr.json 5/5 Added Turkish translations for custom chart type selector interface elements
web/src/locales/languages/es.json 5/5 Added Spanish translations for custom chart type selector interface elements
web/src/locales/languages/it.json 5/5 Added Italian translations for custom chart type selector interface elements
[22 additional chart template files] 3-5/5 Various custom chart templates including treemap, funnel, radar, 3D visualizations, and specialized chart types

Confidence score: 4/5

  • This PR enhances user experience significantly with minimal risk of breaking existing functionality
  • Score reflects some potential issues in chart template implementations including data mapping inconsistencies, hardcoded aliases that don't match example queries, and assumptions about data structure that could cause runtime errors
  • Pay close attention to chart template files, particularly scatterMatrix.ts, barRace.ts, bar3dDataset.ts, and datasetSeriesLayout.ts which contain logic issues that could affect chart rendering

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

41 files reviewed, 27 comments

Edit Code Review Agent Settings | Greptile

option = {
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c}%'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: formatter displays percentage but the data processing doesn't convert values to percentages

Suggested change
formatter: '{a} <br/>{b} : {c}%'
formatter: '{a} <br/>{b} : {c}'

Should the processData function calculate percentages or should the formatter be updated to display raw values?

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates/funnelCustomize.ts
Line: 57:57

Comment:
**logic:** formatter displays percentage but the data processing doesn't convert values to percentages

```suggestion
    formatter: '{a} <br/>{b} : {c}'
```

 Should the processData function calculate percentages or should the formatter be updated to display raw values?

How can I resolve this? If you propose a fix, please make it concise.

radius: [30, '80%']
},
angleAxis: {
max: Math.max(...values) * 1.2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Potential runtime error if values array is empty - Math.max(...[]) returns -Infinity

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates/barPolarStackRadial.ts
Line: 44:44

Comment:
**logic:** Potential runtime error if values array is empty - Math.max(...[]) returns -Infinity

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines 11 to 16
SELECT 'Metric A' as metric, 'Series 2' as series, 70 as value
UNION ALL
SELECT 'Metric B' as metric, 'Series 2' as series, 85 as value
UNION ALL
SELECT 'Metric C' as metric, 'Series 2' as series, 60 as value
UNION ALL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Missing 'from default' clause in these UNION statements - should be consistent with lines 3-9

Suggested change
SELECT 'Metric A' as metric, 'Series 2' as series, 70 as value
UNION ALL
SELECT 'Metric B' as metric, 'Series 2' as series, 85 as value
UNION ALL
SELECT 'Metric C' as metric, 'Series 2' as series, 60 as value
UNION ALL
SELECT 'Metric A' as metric, 'Series 2' as series, 70 as value from default
UNION ALL
SELECT 'Metric B' as metric, 'Series 2' as series, 85 as value from default
UNION ALL
SELECT 'Metric C' as metric, 'Series 2' as series, 60 as value from default
UNION ALL
Prompt To Fix With AI
This is a comment left during a code review.
Path: web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates/radarMultiple2.ts
Line: 11:16

Comment:
**syntax:** Missing 'from default' clause in these UNION statements - should be consistent with lines 3-9

```suggestion
SELECT 'Metric A' as metric, 'Series 2' as series, 70 as value from default
UNION ALL
SELECT 'Metric B' as metric, 'Series 2' as series, 85 as value from default
UNION ALL
SELECT 'Metric C' as metric, 'Series 2' as series, 60 as value from default
UNION ALL
```

How can I resolve this? If you propose a fix, please make it concise.

return { name: 'root', children: rootNodes };
};
const treeData = processData(data[0], nameAlias, parentAlias, valueAlias);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: assumes data[0] exists without nullcheck, could cause runtime error if data is empty

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates/treemapChart.ts
Line: 64:64

Comment:
**logic:** assumes data[0] exists without nullcheck, could cause runtime error if data is empty

How can I resolve this? If you propose a fix, please make it concise.

return { hours: [], days: [], chartData: [] };
}

const hours = ['12a', '1a', '2a', '3a', '4a', '5a', '6a', '7a', '8a', '9a','10a','11a', '12p', '1p', '2p', '3p', '4p', '5p', '6p', '7p', '8p', '9p', '10p', '11p'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Missing spaces in hour labels between '9a','10a','11a' affects readability

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates/bar3dPunchCard.ts
Line: 36:36

Comment:
**style:** Missing spaces in hour labels between '9a','10a','11a' affects readability

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

return { hours, days, chartData: data };
};

const { hours, days, chartData } = processData(data[0]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Accessing data[0] assumes the data structure without validation - this could cause runtime errors if data is empty or has a different structure

Suggested change
const { hours, days, chartData } = processData(data[0]);
const { hours, days, chartData } = processData(data && data.length > 0 ? data[0] : []);

Should there be validation to ensure data[0] exists and has the expected structure?

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates/bar3dPunchCard.ts
Line: 51:51

Comment:
**logic:** Accessing `data[0]` assumes the data structure without validation - this could cause runtime errors if `data` is empty or has a different structure

```suggestion
const { hours, days, chartData } = processData(data && data.length > 0 ? data[0] : []);
```

 Should there be validation to ensure data[0] exists and has the expected structure?

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +3 to +7
const exampleQuery = `SELECT
kubernetes_namespace_name as "x_axis",
kubernetes_container_name as "y_axis",
code as "z_axis"
FROM "default"`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The example query uses column aliases (x_axis, y_axis, z_axis) that don't match the aliases expected in the chart code (category, subcategory, value). This mismatch will cause the chart to display empty data.

Suggested change
const exampleQuery = `SELECT
kubernetes_namespace_name as "x_axis",
kubernetes_container_name as "y_axis",
code as "z_axis"
FROM "default"`;
const exampleQuery = `SELECT
kubernetes_namespace_name as "category",
kubernetes_container_name as "subcategory",
code as "value"
FROM "default"`;
Prompt To Fix With AI
This is a comment left during a code review.
Path: web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates/dataTransformMultiplePie.ts
Line: 3:7

Comment:
**logic:** The example query uses column aliases (x_axis, y_axis, z_axis) that don't match the aliases expected in the chart code (category, subcategory, value). This mismatch will cause the chart to display empty data.

```suggestion
const exampleQuery = `SELECT
kubernetes_namespace_name as "category",
kubernetes_container_name as "subcategory",
code as "value"
FROM "default"`;
```

How can I resolve this? If you propose a fix, please make it concise.

// -----------------------------------------------------------

const yData = chartData.map(item => item[yAlias]);
const zData = chartData.map(item => item[zAlias] || Math.random() * 100);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Using Math.random() as fallback creates misleading data when zAlias values are missing. Consider using 0 or null instead.

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates/bar3dDataset.ts
Line: 36:36

Comment:
**logic:** Using Math.random() as fallback creates misleading data when zAlias values are missing. Consider using 0 or null instead.

How can I resolve this? If you propose a fix, please make it concise.

},
series: [{
type: 'bar3D',
data: xData.map((x, i) => [i, i % yData.length, zData[i]]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The data mapping logic assumes xData and yData have the same length and creates incorrect coordinate mappings. Should map actual category indices, not array indices.

Suggested change
data: xData.map((x, i) => [i, i % yData.length, zData[i]]),
data: chartData.map((item, i) => {
const xIndex = [...new Set(xData)].indexOf(item[xAlias]);
const yIndex = [...new Set(yData)].indexOf(item[yAlias]);
return [xIndex, yIndex, item[zAlias] || 0];
}),

Should this create a proper 3D grid mapping between unique x and y categories instead of using array indices?

Prompt To Fix With AI
This is a comment left during a code review.
Path: web/src/components/dashboards/addPanel/customChartExamples/customChartTemplates/bar3dDataset.ts
Line: 65:65

Comment:
**logic:** The data mapping logic assumes xData and yData have the same length and creates incorrect coordinate mappings. Should map actual category indices, not array indices.

```suggestion
    data: chartData.map((item, i) => {
      const xIndex = [...new Set(xData)].indexOf(item[xAlias]);
      const yIndex = [...new Set(yData)].indexOf(item[yAlias]);
      return [xIndex, yIndex, item[zAlias] || 0];
    }),
```

 Should this create a proper 3D grid mapping between unique x and y categories instead of using array indices?

How can I resolve this? If you propose a fix, please make it concise.

@ktx-vaidehi ktx-vaidehi force-pushed the feat/dashboard/custom-chart-with-examples branch from 504796e to 432c00b Compare December 15, 2025 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants