PromucFlow_constructor/app/client/src/widgets/ChartWidget/index.ts

130 lines
3.5 KiB
TypeScript
Raw Normal View History

import { Colors } from "constants/Colors";
import { FILL_WIDGET_MIN_WIDTH } from "constants/minWidthConstants";
import { ResponsiveBehavior } from "utils/autoLayout/constants";
import { generateReactKey } from "widgets/WidgetUtils";
import { LabelOrientation } from "./constants";
import IconSVG from "./icon.svg";
import Widget from "./widget";
feat: Widget Discoverability (#24934) ## Description Grouping the widgets into categories to make it easier for people to find widgets. This will be behind the feature flag `release_widgetdiscovery_enabled` <img src="https://github.com/appsmithorg/appsmith/assets/22471214/4932a091-1831-4d95-b722-3301580fb6be" height="300px" /> Project home [here on Notion](https://www.notion.so/appsmith/Widget-Discoverability-755cf059a1904950888304b90b74106f?d=8bc3059134984787900a69963dd13d90#27967092cfa74505bab55bd163d28c18). #### PR fixes following issue(s) #24865 #24867 #24868 #24869 #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [ ] Jest - [x] Cypress > > #### Test Plan > (https://github.com/appsmithorg/TestSmith/issues/2440) > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [x] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [x] Test plan has been peer reviewed by project stakeholders and other QA members - [x] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [x] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-07-22 05:57:18 +00:00
import { WIDGET_TAGS } from "constants/WidgetConstants";
export const CONFIG = {
type: Widget.getWidgetType(),
name: "Chart",
iconSVG: IconSVG,
feat: Widget Discoverability (#24934) ## Description Grouping the widgets into categories to make it easier for people to find widgets. This will be behind the feature flag `release_widgetdiscovery_enabled` <img src="https://github.com/appsmithorg/appsmith/assets/22471214/4932a091-1831-4d95-b722-3301580fb6be" height="300px" /> Project home [here on Notion](https://www.notion.so/appsmith/Widget-Discoverability-755cf059a1904950888304b90b74106f?d=8bc3059134984787900a69963dd13d90#27967092cfa74505bab55bd163d28c18). #### PR fixes following issue(s) #24865 #24867 #24868 #24869 #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [ ] Jest - [x] Cypress > > #### Test Plan > (https://github.com/appsmithorg/TestSmith/issues/2440) > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [x] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [x] Test plan has been peer reviewed by project stakeholders and other QA members - [x] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [x] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-07-22 05:57:18 +00:00
tags: [WIDGET_TAGS.DISPLAY],
needsMeta: true,
searchTags: ["graph", "visuals", "visualisations"],
defaults: {
rows: 32,
columns: 24,
widgetName: "Chart",
chartType: "COLUMN_CHART",
chartName: "Sales Report",
allowScroll: false,
version: 1,
animateLoading: true,
responsiveBehavior: ResponsiveBehavior.Fill,
minWidth: FILL_WIDGET_MIN_WIDTH,
chartData: {
[generateReactKey()]: {
seriesName: "2023",
data: [
{
x: "Product1",
y: 20000,
},
{
x: "Product2",
y: 22000,
},
{
x: "Product3",
y: 32000,
},
],
},
},
xAxisName: "Product Line",
yAxisName: "Revenue($)",
labelOrientation: LabelOrientation.AUTO,
customFusionChartConfig: {
type: "column2d",
dataSource: {
data: [
{
label: "Product1",
value: 20000,
},
{
label: "Product2",
value: 22000,
},
{
label: "Product3",
value: 32000,
},
],
chart: {
caption: "Sales Report",
xAxisName: "Product Line",
yAxisName: "Revenue($)",
theme: "fusion",
alignCaptionWithCanvas: 1,
// Caption styling =======================
captionFontSize: "24",
captionAlignment: "center",
captionPadding: "20",
captionFontColor: Colors.THUNDER,
// legend position styling ==========
legendIconSides: "4",
legendIconBgAlpha: "100",
legendIconAlpha: "100",
legendPosition: "top",
// Canvas styles ========
canvasPadding: "0",
// Chart styling =======
chartLeftMargin: "20",
chartTopMargin: "10",
chartRightMargin: "40",
chartBottomMargin: "10",
// Axis name styling ======
xAxisNameFontSize: "14",
labelFontSize: "12",
labelFontColor: Colors.DOVE_GRAY2,
xAxisNameFontColor: Colors.DOVE_GRAY2,
yAxisNameFontSize: "14",
yAxisValueFontSize: "12",
yAxisValueFontColor: Colors.DOVE_GRAY2,
yAxisNameFontColor: Colors.DOVE_GRAY2,
},
},
},
},
properties: {
derived: Widget.getDerivedPropertiesMap(),
default: Widget.getDefaultPropertiesMap(),
meta: Widget.getMetaPropertiesMap(),
config: Widget.getPropertyPaneConfig(),
chore: Property Pane Grouping of Chart, Maps & Media widgets (#15557) * POC: Grouping for ButtonWidget * Adds featureflag * improve feature flag experience for unfinished widgets * Styling of tabs * Adds activation group for ButtonWidget * Makes contentConfig & styleCOnfig optional to avoid typescript errors from tests * Adds UI for search * Fixes title, search & tabs UI to the top * fix: style issue * fix styles * refactor ProeprtyPaneTab * updates Button based on Figma design changes * POC for AudioWidget * chore: JSON Form Grouping & Reorganisation (#15033) * POC: JSON Form grouping * fix: Empty sections * Moves icon into a separate sub section * fix some sections based on updated Designs * fix styling issues * fix: double border * udpdates based on Figma updates * Updates order as per Figma * refactor and better naming of function * address review comments for JSON form configs * fix UI issues * reorder JSON form's array data section * Adds Button Form settings * Address QA comments * update JSON form with new design changes * Adds FilePickerWidget * Adds MapChartWidget * Adds ContainerWidget * Adds MapWidget * Adds ImageWidget * Adds AudioRecorderWidget * Adds CameraWidget * Adds ChartWidget * fix: issues found in design review * Open array & object style by default * trigger ci * chore: Grouping & reorganisation of Video widget (#15297) * POC: JSON Form grouping * fix: Empty sections * Moves icon into a separate sub section * fix some sections based on updated Designs * fix styling issues * fix: double border * udpdates based on Figma updates * Updates order as per Figma * Content & Style Config for Video Widget * refactor and better naming of function * address review comments for JSON form configs * fix UI issues * ?? * chore: Grouping & reorganisation of Document Viewer widget (#15514) * Grouping & re-org for Document Viewer * fix: scroll issue * Adds FormWidget * fix: mapchart style section heading * refactor: cleanup * incoorporate latest change for Camera widget
2022-08-09 13:05:36 +00:00
contentConfig: Widget.getPropertyPaneContentConfig(),
styleConfig: Widget.getPropertyPaneStyleConfig(),
stylesheetConfig: Widget.getStylesheetConfig(),
autocompleteDefinitions: Widget.getAutocompleteDefinitions(),
},
autoLayout: {
widgetSize: [
{
viewportMinWidth: 0,
configuration: () => {
return {
minWidth: "280px",
minHeight: "300px",
};
},
},
],
},
};
export default Widget;