-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
removing old point series defaults #11958
Changes from all commits
115a65d
c8aa993
73c8a30
cba58c9
cccda99
0799227
b884842
dc6b2c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,12 +15,15 @@ export function VislibVisTypeVislibVisTypeProvider(Private) { | |
const pointSeries = Private(AggResponsePointSeriesProvider); | ||
const VislibRenderbot = Private(VislibVisTypeVislibRenderbotProvider); | ||
|
||
// converts old config format (pre 5.2) to the new one | ||
const updateParams = function (params) { | ||
if (!params.seriesParams || !params.seriesParams.length) return; | ||
if (params.seriesParams && params.seriesParams.length) return; | ||
params.seriesParams = [{}]; | ||
|
||
const updateIfSet = (from, to, prop, func) => { | ||
if (from[prop]) { | ||
to[prop] = func ? func(from[prop]) : from[prop]; | ||
delete from[prop]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool thanks for fixing this! Minor, unrelated to this PR feedback - I think a comment for this updateParams function would be helpful. It was hard for me to figure out what was it was for. :) Plus then at some point way down the line if we stop supporting pre 5.2 we can get rid of the code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to see the comment added in this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is there @archanid |
||
} | ||
}; | ||
|
||
|
@@ -30,6 +33,10 @@ export function VislibVisTypeVislibVisTypeProvider(Private) { | |
updateIfSet(params, params.seriesParams[0], 'interpolate'); | ||
updateIfSet(params, params.seriesParams[0], 'type'); | ||
|
||
if (params.gauge) { | ||
updateIfSet(params, params.gauge.style, 'fontSize'); | ||
} | ||
|
||
if (params.mode) { | ||
const stacked = ['stacked', 'percentage', 'wiggle', 'silhouette'].includes(params.mode); | ||
params.seriesParams[0].mode = stacked ? 'stacked' : 'normal'; | ||
|
@@ -43,15 +50,19 @@ export function VislibVisTypeVislibVisTypeProvider(Private) { | |
delete params.smoothLines; | ||
} | ||
|
||
updateIfSet(params, params.valueAxes[0].scale, 'setYExtents'); | ||
updateIfSet(params, params.valueAxes[0].scale, 'defaultYExtents'); | ||
if (params.valueAxes) { | ||
updateIfSet(params, params.valueAxes[0].scale, 'setYExtents'); | ||
updateIfSet(params, params.valueAxes[0].scale, 'defaultYExtents'); | ||
} | ||
|
||
if (params.scale) { | ||
params.valueAxes[0].scale.type = params.scale; | ||
delete params.scale; | ||
} | ||
|
||
updateIfSet(params, params.categoryAxes[0], 'expandLastBucket'); | ||
if (params.categoryAxis && params.categoryAxis.length) { | ||
updateIfSet(params, params.categoryAxes[0], 'expandLastBucket'); | ||
} | ||
}; | ||
|
||
_.class(VislibVisType).inherits(VisType); | ||
|
@@ -66,7 +77,7 @@ export function VislibVisTypeVislibVisTypeProvider(Private) { | |
} | ||
|
||
VislibVisType.prototype.createRenderbot = function (vis, $el, uiState) { | ||
updateParams(vis.params); | ||
if (vis.type.name !== 'pie') updateParams(vis.params); | ||
return new VislibRenderbot(vis, $el, uiState); | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@archanid ... i was refering to this comment