From a07d220ba37d35feaaa7d4d414afb9d31ac73297 Mon Sep 17 00:00:00 2001 From: cnathe Date: Tue, 26 Nov 2024 09:53:50 -0600 Subject: [PATCH] CR feedback: use const/let, async/await, forEach --- .../chartWizard/chartTypeDialog/trendlineField.js | 3 +-- .../web/vis/genericChart/genericChartHelper.js | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/visualization/resources/web/vis/chartWizard/chartTypeDialog/trendlineField.js b/visualization/resources/web/vis/chartWizard/chartTypeDialog/trendlineField.js index 2f3b96ed38c..93b0e2e1044 100644 --- a/visualization/resources/web/vis/chartWizard/chartTypeDialog/trendlineField.js +++ b/visualization/resources/web/vis/chartWizard/chartTypeDialog/trendlineField.js @@ -48,8 +48,7 @@ Ext4.define('LABKEY.vis.TrendlineField', { }, getTrendlineTypeCombo: function() { - if (!this.trendlineTypeCombo) - { + if (!this.trendlineTypeCombo) { this.trendlineTypeCombo = Ext4.create('Ext.form.field.ComboBox', { name: 'trendlineType', fieldLabel: 'Type', diff --git a/visualization/resources/web/vis/genericChart/genericChartHelper.js b/visualization/resources/web/vis/genericChart/genericChartHelper.js index e9eb9fa83e7..2b386c693d5 100644 --- a/visualization/resources/web/vis/genericChart/genericChartHelper.js +++ b/visualization/resources/web/vis/genericChart/genericChartHelper.js @@ -93,10 +93,10 @@ LABKEY.vis.GenericChartHelper = new function(){ /** * Gets the chart type (i.e. box or scatter) based on the chartConfig object. */ - var getChartType = function(chartConfig) + const getChartType = function(chartConfig) { - var renderType = chartConfig.renderType - var xAxisType = chartConfig.measures.x ? (chartConfig.measures.x.normalizedType || chartConfig.measures.x.type) : null; + const renderType = chartConfig.renderType + const xAxisType = chartConfig.measures.x ? (chartConfig.measures.x.normalizedType || chartConfig.measures.x.type) : null; if (renderType === 'time_chart' || renderType === "bar_chart" || renderType === "pie_chart" || renderType === "box_plot" || renderType === "scatter_plot" || renderType === "line_plot") @@ -1083,8 +1083,8 @@ LABKEY.vis.GenericChartHelper = new function(){ $.each(yMeasures, function(idx, yMeasure) { var pathAes = { sortFn: function(a, b) { - var aVal = _getRowValue(a, xName); - var bVal = _getRowValue(b, xName); + const aVal = _getRowValue(a, xName); + const bVal = _getRowValue(b, xName); // No need to handle the case for a or b or a.getValue() or b.getValue() null as they are // not currently included in this plot. @@ -1098,7 +1098,7 @@ LABKEY.vis.GenericChartHelper = new function(){ pathAes[yMeasure.yAxis === 'right' ? 'yRight' : 'yLeft'] = getYMeasureAes(yMeasure); // use the series measure's values for the distinct colors and grouping - var hasSeries = chartConfig.measures.series !== undefined; + const hasSeries = chartConfig.measures.series !== undefined; if (hasSeries) { pathAes.pathColor = generateGroupingAcc(chartConfig.measures.series.name); pathAes.group = generateGroupingAcc(chartConfig.measures.series.name); @@ -1112,7 +1112,7 @@ LABKEY.vis.GenericChartHelper = new function(){ if (trendlineData) { trendlineData.forEach(trendline => { if (trendline.data) { - var layerAes = { x: 'x', y: 'y' }; + const layerAes = { x: 'x', y: 'y' }; if (hasSeries) { layerAes.pathColor = function () { return trendline.name }; }