sadpandajoe commented on code in PR #43863:
URL: https://github.com/apache/superset/pull/43863#discussion_r3937629663


##########
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts:
##########
@@ -0,0 +1,533 @@
+/**
+ * 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 {
+  AxisType,
+  CurrencyFormatter,
+  DataRecord,
+  ensureIsArray,
+  getColumnLabel,
+  getMetricLabel,
+  getNumberFormatter,
+  getTimeFormatter,
+  NumberFormatter,
+  rgbToHex,
+  tooltipHtml,
+} from '@superset-ui/core';
+import { GenericDataType } from '@apache-superset/core/common';
+import type { EChartsCoreOption } from 'echarts/core';
+import type { CandlestickSeriesOption, LineSeriesOption } from 
'echarts/charts';
+import type { CallbackDataParams } from 'echarts/types/src/util/types';
+import {
+  CandlestickChartTransformedProps,
+  EchartsCandlestickChartProps,
+} from './types';
+import {
+  CANDLESTICK_SERIES_NAME,
+  DEFAULT_DECREASE_COLOR,
+  DEFAULT_FORM_DATA,
+  DEFAULT_INCREASE_COLOR,
+  DIRECTION_LABELS,
+  OHLC_LABELS,
+} from './constants';
+import { defaultGrid, defaultYAxis } from '../defaults';
+import { getDefaultTooltip } from '../utils/tooltip';
+import {
+  extractGroupbyLabel,
+  getChartPadding,
+  getColtypesMapping,
+  getLegendProps,
+} from '../utils/series';
+import { convertInteger } from '../utils/convertInteger';
+import { mergeCustomEChartOptions } from '../utils/mergeCustomEChartOptions';
+import { safeParseEChartOptions } from '../utils/safeEChartOptionsParser';
+import { NULL_STRING, TIMESERIES_CONSTANTS } from '../constants';
+import { LegendOrientation, LegendType, Refs } from '../types';
+import { resolveLegendLayout } from '../utils/legendLayout';
+import {
+  calculateMA,
+  MA_LINE_OPACITY,
+  movingAverageName,
+  parseMovingAveragePeriods,
+} from './utils';
+
+type OhlcValue = [number, number, number, number];
+type CandlestickDatum = NonNullable<CandlestickSeriesOption['data']>[number];
+
+function toNumber(value: unknown): number | null {
+  if (value === null || value === undefined || value === '') {
+    return null;
+  }
+  const numeric = Number(value);
+  return Number.isFinite(numeric) ? numeric : null;
+}
+
+function getOwnValue<T extends object>(
+  object: T,
+  key: string,
+): T[keyof T] | undefined {
+  return key && Object.hasOwn(object, key) ? object[key as keyof T] : 
undefined;
+}
+
+function toCategoryKey(value: unknown): string {
+  return value == null ? NULL_STRING : String(value);

Review Comment:
   This uses the display placeholder as the lookup key, so a database NULL and 
a literal "<NULL>" category or series value collide. The Set/Map then discards 
one candle rather than rendering both. Could the internal key use a distinct 
null sentinel and only format the placeholder for display?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to