mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
feat: Support maxAxisCount in axisSpec
This commit is contained in:
parent
936901b553
commit
0484e1ee6b
3 changed files with 40 additions and 16 deletions
|
|
@ -87,20 +87,10 @@ limitations under the License.
|
|||
style="font-weight: 300; font-size: 13px; margin-left: 1px;">
|
||||
{{getAxisAnnotation(axisSpec)}}
|
||||
</span>
|
||||
<span ng-if="isAggregatorAxis(axisSpec)"
|
||||
class="label label-default"
|
||||
style="background-color: #5782bd; font-weight: 300; font-size: 13px; margin-left: 3px;">
|
||||
aggregator
|
||||
</span>
|
||||
<span ng-if="isGroupAxis(axisSpec)"
|
||||
class="label label-default"
|
||||
style="background-color: #cd5c5c; font-weight: 300; font-size: 13px; margin-left: 3px;">
|
||||
group
|
||||
</span>
|
||||
<span ng-if="isKeyAxis(axisSpec)"
|
||||
class="label label-default"
|
||||
style="background-color: #906ebd; font-weight: 300; font-size: 13px; margin-left: 3px;">
|
||||
key
|
||||
<span class="label label-default"
|
||||
ng-style="getAxisTypeAnnotationColor(axisSpec)"
|
||||
style="font-weight: 300; font-size: 13px; margin-left: 3px;">
|
||||
{{getAxisTypeAnnotation(axisSpec)}}
|
||||
</span>
|
||||
|
||||
<!-- axis box: in case of single dimension -->
|
||||
|
|
@ -226,7 +216,7 @@ limitations under the License.
|
|||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th style="font-size: 12px; font-style: italic">Name</th>
|
||||
<th style="font-size: 13px; font-style: italic">Type</th>
|
||||
<th style="font-size: 12px; font-style: italic">Type</th>
|
||||
<th style="font-size: 12px; font-style: italic">Description</th>
|
||||
<th style="font-size: 12px; font-style: italic">Value</th>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -65,6 +65,19 @@ export function getAvailableChartNames(charts) {
|
|||
return available
|
||||
}
|
||||
|
||||
export function applyMaxAxisCount(config, axisSpec) {
|
||||
console.log(axisSpec)
|
||||
if (isSingleDimension(axisSpec) || typeof axisSpec.maxAxisCount === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
const columns = getCurrentChartAxis(config)[axisSpec.name]
|
||||
if (columns.length <= axisSpec.maxAxisCount) { return; }
|
||||
|
||||
const sliced = columns.slice(1)
|
||||
getCurrentChartAxis(config)[axisSpec.name] = sliced
|
||||
}
|
||||
|
||||
export function removeDuplicatedColumnsInMultiDimensionAxis(config, axisSpec) {
|
||||
if (isSingleDimension(axisSpec)) { return config; }
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ import Transformation from './transformation';
|
|||
|
||||
import {
|
||||
isAggregator, isGroup, isKey, isSingleDimension,
|
||||
clearConfig, initializeConfig, removeDuplicatedColumnsInMultiDimensionAxis,
|
||||
clearConfig, initializeConfig,
|
||||
removeDuplicatedColumnsInMultiDimensionAxis, applyMaxAxisCount,
|
||||
getCubeWithSchema, getColumnsFromAxis,
|
||||
} from './advanced-transformation-util';
|
||||
|
||||
|
|
@ -59,6 +60,25 @@ class AdvancedTransformation extends Transformation {
|
|||
return anno
|
||||
},
|
||||
|
||||
getAxisTypeAnnotation: (axisSpec) => {
|
||||
let anno = `${axisSpec.axisType}`
|
||||
if (typeof axisSpec.maxAxisCount !== "undefined") {
|
||||
anno = `${anno} (${axisSpec.maxAxisCount})`
|
||||
}
|
||||
|
||||
return anno
|
||||
},
|
||||
|
||||
getAxisTypeAnnotationColor: (axisSpec) => {
|
||||
if (isAggregator(axisSpec)) {
|
||||
return { 'background-color': '#5782bd' };
|
||||
} else if (isGroup(axisSpec)) {
|
||||
return { 'background-color': '#cd5c5c' };
|
||||
} else if (isKey(axisSpec)) {
|
||||
return { 'background-color': '#906ebd' };
|
||||
}
|
||||
},
|
||||
|
||||
getSingleDimensionAxis: (axisSpec) => {
|
||||
return getCurrentChartAxis(configInstance)[axisSpec.name]
|
||||
},
|
||||
|
|
@ -95,6 +115,7 @@ class AdvancedTransformation extends Transformation {
|
|||
|
||||
axisChanged: function(e, ui, axisSpec) {
|
||||
removeDuplicatedColumnsInMultiDimensionAxis(configInstance, axisSpec)
|
||||
applyMaxAxisCount(configInstance, axisSpec)
|
||||
self.emitConfig(configInstance)
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue