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

110 lines
2.9 KiB
TypeScript
Raw Normal View History

import { Colors } from "constants/Colors";
import { generateReactKey } from "widgets/WidgetUtils";
import { LabelOrientation } from "./constants";
import IconSVG from "./icon.svg";
import Widget from "./widget";
export const CONFIG = {
type: Widget.getWidgetType(),
name: "Chart",
iconSVG: IconSVG,
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,
chartData: {
[generateReactKey()]: {
seriesName: "Sales",
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(),
},
};
export default Widget;