mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 20:51:48 +00:00
add chat plugin and split query to parse and execute (#25)
* [feature](webapp) add drill down dimensions and metric period compare and modify layout * [feature](webapp) add drill down dimensions and metric period compare and modify layout * [feature](webapp) gitignore add supersonic-webapp * [feature](webapp) gitignore add supersonic-webapp * [feature](webapp) add chat plugin and split query to parse and execute * [feature](webapp) add chat plugin and split query to parse and execute * [feature](webapp) add chat plugin and split query to parse and execute --------- Co-authored-by: williamhliu <williamhliu@tencent.com>
This commit is contained in:
@@ -31,7 +31,7 @@ const BarChart: React.FC<Props> = ({
|
||||
|
||||
const { queryColumns, queryResults, entityInfo, chatContext, queryMode } = data;
|
||||
|
||||
const { dateInfo } = chatContext || {};
|
||||
const { dateInfo, dimensionFilters } = chatContext || {};
|
||||
|
||||
const categoryColumnName =
|
||||
queryColumns?.find(column => column.showType === 'CATEGORY')?.nameEn || '';
|
||||
@@ -51,13 +51,6 @@ const BarChart: React.FC<Props> = ({
|
||||
);
|
||||
const xData = data.map(item => item[categoryColumnName]);
|
||||
instanceObj.setOption({
|
||||
// legend: {
|
||||
// left: 0,
|
||||
// top: 0,
|
||||
// icon: 'rect',
|
||||
// itemWidth: 15,
|
||||
// itemHeight: 5,
|
||||
// },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
axisTick: {
|
||||
@@ -166,21 +159,43 @@ const BarChart: React.FC<Props> = ({
|
||||
);
|
||||
}
|
||||
|
||||
const hasFilterSection = dimensionFilters?.length > 0;
|
||||
|
||||
const prefixCls = `${PREFIX_CLS}-bar`;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={`${PREFIX_CLS}-bar-metric-name`}>{metricColumn?.name}</div>
|
||||
<FilterSection chatContext={chatContext} />
|
||||
<div className={`${prefixCls}-top-bar`}>
|
||||
<div className={`${prefixCls}-indicator-name`}>{metricColumn?.name}</div>
|
||||
{(hasFilterSection || drillDownDimension) && (
|
||||
<div className={`${prefixCls}-filter-section-wrapper`}>
|
||||
(
|
||||
<div className={`${prefixCls}-filter-section`}>
|
||||
<FilterSection chatContext={chatContext} entityInfo={entityInfo} />
|
||||
{drillDownDimension && (
|
||||
<div className={`${prefixCls}-filter-item`}>
|
||||
<div className={`${prefixCls}-filter-item-label`}>下钻维度:</div>
|
||||
<div className={`${prefixCls}-filter-item-value`}>{drillDownDimension.name}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{dateInfo && (
|
||||
<div className={`${PREFIX_CLS}-bar-date-range`}>
|
||||
<div className={`${prefixCls}-date-range`}>
|
||||
{dateInfo.startDate === dateInfo.endDate
|
||||
? dateInfo.startDate
|
||||
: `${dateInfo.startDate} ~ ${dateInfo.endDate}`}
|
||||
</div>
|
||||
)}
|
||||
<Spin spinning={loading}>
|
||||
<div className={`${PREFIX_CLS}-bar-chart`} ref={chartRef} />
|
||||
<div className={`${prefixCls}-chart`} ref={chartRef} />
|
||||
</Spin>
|
||||
{(queryMode === 'METRIC_DOMAIN' || queryMode === 'METRIC_FILTER') && (
|
||||
{(queryMode === 'METRIC_DOMAIN' ||
|
||||
queryMode === 'METRIC_FILTER' ||
|
||||
queryMode === 'METRIC_GROUPBY') && (
|
||||
<DrillDownDimensions
|
||||
domainId={chatContext.domainId}
|
||||
drillDownDimension={drillDownDimension}
|
||||
|
||||
Reference in New Issue
Block a user