mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
adding stepped line to line and area charts
This commit is contained in:
parent
fa6d074bf4
commit
be913a4a31
5 changed files with 32 additions and 9 deletions
|
@ -19,7 +19,6 @@ export default function HistogramVisType(Private) {
|
|||
addTooltip: true,
|
||||
addLegend: true,
|
||||
legendPosition: 'right',
|
||||
smoothLines: false,
|
||||
scale: 'linear',
|
||||
interpolate: 'linear',
|
||||
mode: 'stacked',
|
||||
|
@ -41,6 +40,16 @@ export default function HistogramVisType(Private) {
|
|||
value: 'bottom',
|
||||
text: 'bottom',
|
||||
}],
|
||||
interpolationModes: [{
|
||||
value: 'linear',
|
||||
text: 'normal',
|
||||
}, {
|
||||
value: 'cardinal',
|
||||
text: 'smoothed',
|
||||
}, {
|
||||
value: 'step-after',
|
||||
text: 'stepped',
|
||||
}],
|
||||
scales: ['linear', 'log', 'square root'],
|
||||
modes: ['stacked', 'overlap', 'percentage', 'wiggle', 'silhouette'],
|
||||
editor: areaTemplate
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
<div>
|
||||
<label>
|
||||
<input type="checkbox" value="{{smoothLines}}" ng-model="vis.params.smoothLines" name="smoothLines"
|
||||
ng-checked="vis.params.smoothLines">
|
||||
Smooth Lines
|
||||
Line Mode
|
||||
</label>
|
||||
<select
|
||||
class="form-control"
|
||||
ng-model="vis.params.interpolate"
|
||||
ng-options="mode.value as mode.text for mode in vis.type.params.interpolationModes"
|
||||
>
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -18,7 +18,6 @@ export default function HistogramVisType(Private) {
|
|||
addLegend: true,
|
||||
legendPosition: 'right',
|
||||
showCircles: true,
|
||||
smoothLines: false,
|
||||
interpolate: 'linear',
|
||||
scale: 'linear',
|
||||
drawLinesBetweenPoints: true,
|
||||
|
@ -41,6 +40,16 @@ export default function HistogramVisType(Private) {
|
|||
value: 'bottom',
|
||||
text: 'bottom',
|
||||
}],
|
||||
interpolationModes: [{
|
||||
value: 'linear',
|
||||
text: 'normal',
|
||||
}, {
|
||||
value: 'cardinal',
|
||||
text: 'smoothed',
|
||||
}, {
|
||||
value: 'step-after',
|
||||
text: 'stepped',
|
||||
}],
|
||||
scales: ['linear', 'log', 'square root'],
|
||||
editor: lineTemplate
|
||||
},
|
||||
|
|
|
@ -4,6 +4,9 @@ export default function ColumnHandler(Private) {
|
|||
|
||||
const createSeries = (cfg, series) => {
|
||||
const stacked = ['stacked', 'percentage', 'wiggle', 'silhouette'].includes(cfg.mode);
|
||||
let interpolate = cfg.interpolate;
|
||||
if (cfg.smoothLines) interpolate = 'cardinal';
|
||||
|
||||
return {
|
||||
type: 'point_series',
|
||||
series: _.map(series, (seri) => {
|
||||
|
@ -11,8 +14,7 @@ export default function ColumnHandler(Private) {
|
|||
show: true,
|
||||
type: cfg.type || 'line',
|
||||
mode: stacked ? 'stacked' : 'normal',
|
||||
interpolate: cfg.interpolate,
|
||||
smoothLines: cfg.smoothLines,
|
||||
interpolate: interpolate,
|
||||
drawLinesBetweenPoints: cfg.drawLinesBetweenPoints,
|
||||
showCircles: cfg.showCircles,
|
||||
radiusRatio: cfg.radiusRatio,
|
||||
|
|
|
@ -10,7 +10,6 @@ export default function LineChartFactory(Private) {
|
|||
showCircles: true,
|
||||
radiusRatio: 9,
|
||||
showLines: true,
|
||||
smoothLines: false,
|
||||
interpolate: 'linear',
|
||||
color: undefined,
|
||||
fillColor: undefined
|
||||
|
@ -142,7 +141,7 @@ export default function LineChartFactory(Private) {
|
|||
const xAxisFormatter = this.handler.data.get('xAxisFormatter');
|
||||
const color = this.handler.data.getColorFunc();
|
||||
const ordered = this.handler.data.get('ordered');
|
||||
const interpolate = (this.seriesConfig.smoothLines) ? 'cardinal' : this.seriesConfig.interpolate;
|
||||
const interpolate = this.seriesConfig.interpolate;
|
||||
const isHorizontal = this.getCategoryAxis().axisConfig.isHorizontal();
|
||||
|
||||
const line = svg.append('g')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue