This repository has been archived by the owner on Dec 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugin-chart-echarts): add x and y label support for 9 charts (#…
…1351) * feat: add x and y label support for timeseries fix #16512 * feat: change label to title * feat: add x/y title to 9 chats * refactor: move config to shared-control * refactor: add chartTitle section config in custom tab * refactor: refactor param names * lint: code lint * refactor: refactor code * lint: lint code * feat: make ypostion clearable false * lint: code lint Co-authored-by: xuzhebin <maxhui2020@gmail.com>
- Loading branch information
1 parent
29aac8c
commit cb67e32
Showing
18 changed files
with
246 additions
and
103 deletions.
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
packages/superset-ui-chart-controls/src/sections/chartTitle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import React from 'react'; | ||
import { t } from '@superset-ui/core'; | ||
import { ControlPanelSectionConfig } from '../types'; | ||
import { formatSelectOptions } from '../utils'; | ||
|
||
const TITLE_MARGIN_OPTIONS: number[] = [15, 30, 50, 75, 100, 125, 150, 200]; | ||
const TITLE_POSITION_OPTIONS: string[] = ['Left', 'Top']; | ||
export const titleControls: ControlPanelSectionConfig = { | ||
label: t('Chart Title'), | ||
tabOverride: 'customize', | ||
expanded: true, | ||
controlSetRows: [ | ||
[<h1 className="section-header">{t('X Axis')}</h1>], | ||
[ | ||
{ | ||
name: 'x_axis_title', | ||
config: { | ||
type: 'TextControl', | ||
label: t('X Axis Title'), | ||
renderTrigger: true, | ||
default: '', | ||
description: t('Changing this control takes effect instantly'), | ||
}, | ||
}, | ||
], | ||
[ | ||
{ | ||
name: 'x_axis_title_margin', | ||
config: { | ||
type: 'SelectControl', | ||
freeForm: true, | ||
clearable: true, | ||
label: t('X AXIS TITLE BOTTOM MARGIN'), | ||
renderTrigger: true, | ||
default: TITLE_MARGIN_OPTIONS[0], | ||
choices: formatSelectOptions(TITLE_MARGIN_OPTIONS), | ||
description: t('Changing this control takes effect instantly'), | ||
}, | ||
}, | ||
], | ||
[<h1 className="section-header">{t('Y Axis')}</h1>], | ||
[ | ||
{ | ||
name: 'y_axis_title', | ||
config: { | ||
type: 'TextControl', | ||
label: t('Y Axis Title'), | ||
renderTrigger: true, | ||
default: '', | ||
description: t('Changing this control takes effect instantly'), | ||
}, | ||
}, | ||
], | ||
[ | ||
{ | ||
name: 'y_axis_title_margin', | ||
config: { | ||
type: 'SelectControl', | ||
freeForm: true, | ||
clearable: true, | ||
label: t('Y AXIS TITLE MARGIN'), | ||
renderTrigger: true, | ||
default: TITLE_MARGIN_OPTIONS[0], | ||
choices: formatSelectOptions(TITLE_MARGIN_OPTIONS), | ||
description: t('Changing this control takes effect instantly'), | ||
}, | ||
}, | ||
], | ||
[ | ||
{ | ||
name: 'y_axis_title_position', | ||
config: { | ||
type: 'SelectControl', | ||
freeForm: true, | ||
clearable: false, | ||
label: t('Y AXIS TITLE POSITION'), | ||
renderTrigger: true, | ||
default: TITLE_POSITION_OPTIONS[0], | ||
choices: formatSelectOptions(TITLE_POSITION_OPTIONS), | ||
description: t('Changing this control takes effect instantly'), | ||
}, | ||
}, | ||
], | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
cb67e32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: