mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
XYChart: Ensure color scale is field-local and synced with data updates (#70480)
This commit is contained in:
parent
bc3d704909
commit
3007e3b209
@ -115,18 +115,20 @@ function getScatterSeries(
|
|||||||
if (dims.pointColorIndex) {
|
if (dims.pointColorIndex) {
|
||||||
const f = frames[frameIndex].fields[dims.pointColorIndex];
|
const f = frames[frameIndex].fields[dims.pointColorIndex];
|
||||||
if (f) {
|
if (f) {
|
||||||
const disp =
|
|
||||||
f.display ??
|
|
||||||
getDisplayProcessor({
|
|
||||||
field: f,
|
|
||||||
theme: config.theme2,
|
|
||||||
});
|
|
||||||
pointColorMode = getFieldColorModeForField(y);
|
pointColorMode = getFieldColorModeForField(y);
|
||||||
if (pointColorMode.isByValue) {
|
if (pointColorMode.isByValue) {
|
||||||
const index = dims.pointColorIndex;
|
const index = dims.pointColorIndex;
|
||||||
pointColor = (frame: DataFrame) => {
|
pointColor = (frame: DataFrame) => {
|
||||||
// Yes we can improve this later
|
const field = frame.fields[index];
|
||||||
return frame.fields[index].values.map((v) => disp(v).color!);
|
|
||||||
|
if (field.state?.range) {
|
||||||
|
// this forces local min/max recalc, rather than using global min/max from field.state
|
||||||
|
field.state.range = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
field.display = getDisplayProcessor({ field, theme: config.theme2 });
|
||||||
|
|
||||||
|
return field.values.map((v) => field.display!(v).color!); // slow!
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
seriesColor = pointColorMode.getCalculator(f, config.theme2)(f.values[0], 1);
|
seriesColor = pointColorMode.getCalculator(f, config.theme2)(f.values[0], 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user