ktmud commented on a change in pull request #9525: Migrating shared NVD3 
controls to new module
URL: 
https://github.com/apache/incubator-superset/pull/9525#discussion_r409994251
 
 

 ##########
 File path: superset-frontend/src/explore/controlPanels/TimePivot.js
 ##########
 @@ -17,47 +17,99 @@
  * under the License.
  */
 import { t } from '@superset-ui/translation';
-import { D3_TIME_FORMAT_OPTIONS } from '../controls';
+import { D3_FORMAT_OPTIONS } from '../controls';
+import {
+  lineInterpolation,
+  showLegend,
+  xAxisLabel,
+  bottomMargin,
+  xAxisFormat,
+  yLogScale,
+  yAxisBounds,
+  xAxisShowMinmax,
+  yAxisShowMinmax,
+  yAxisLabel,
+  leftMargin,
+} from './Shared_NVD3';
 
 export default {
   requiresTime: true,
   controlPanelSections: [
     {
       label: t('Query'),
       expanded: true,
-      controlSetRows: [['metric'], ['adhoc_filters'], ['freq']],
+      controlSetRows: [
+        ['metric'],
+        ['adhoc_filters'],
+        [
+          {
+            name: 'freq',
+            config: {
+              type: 'SelectControl',
+              label: t('Frequency'),
+              default: 'W-MON',
+              freeForm: true,
+              clearable: false,
+              choices: [
+                ['AS', 'Year (freq=AS)'],
+                ['52W-MON', '52 weeks starting Monday (freq=52W-MON)'],
+                ['W-SUN', '1 week starting Sunday (freq=W-SUN)'],
+                ['W-MON', '1 week starting Monday (freq=W-MON)'],
+                ['D', 'Day (freq=D)'],
+                ['4W-MON', '4 weeks (freq=4W-MON)'],
+              ],
+              description: t(
+                `The periodicity over which to pivot time. Users can provide
+            "Pandas" offset alias.
+            Click on the info bubble for more details on accepted "freq" 
expressions.`,
+              ),
+              tooltipOnClick: () => {
+                window.open(
+                  
'https://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases',
+                );
+              },
+            },
+          },
+        ],
+      ],
     },
     {
       label: t('Chart Options'),
       expanded: true,
       controlSetRows: [
-        ['show_legend', 'line_interpolation'],
+        [showLegend, lineInterpolation],
         ['color_picker', null],
       ],
     },
     {
       label: t('X Axis'),
       expanded: true,
       controlSetRows: [
-        ['x_axis_label', 'bottom_margin'],
-        ['x_axis_showminmax', 'x_axis_format'],
+        [xAxisLabel, bottomMargin],
+        [
+          xAxisShowMinmax,
+          {
 
 Review comment:
   I agree for any utility functions we introduce we should also consider 
whether it makes sense to expose to future plugin developers. Ideally there 
should be a straightforward public API with which developers can do most of 
what they want without the need of diving into the internals of the plugin 
system.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to