mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
GraphNG: remove y-axis position control from series color picker in the legend (#30302)
This commit is contained in:
parent
c14c7b6874
commit
a94c256516
@ -12,11 +12,9 @@ export interface SeriesColorPickerPopoverProps extends ColorPickerProps, Popover
|
|||||||
|
|
||||||
export const SeriesColorPickerPopover: FunctionComponent<SeriesColorPickerPopoverProps> = props => {
|
export const SeriesColorPickerPopover: FunctionComponent<SeriesColorPickerPopoverProps> = props => {
|
||||||
const { yaxis, onToggleAxis, color, ...colorPickerProps } = props;
|
const { yaxis, onToggleAxis, color, ...colorPickerProps } = props;
|
||||||
return (
|
|
||||||
<ColorPickerPopover
|
const customPickers = onToggleAxis
|
||||||
{...colorPickerProps}
|
? {
|
||||||
color={color || '#000000'}
|
|
||||||
customPickers={{
|
|
||||||
yaxis: {
|
yaxis: {
|
||||||
name: 'Y-Axis',
|
name: 'Y-Axis',
|
||||||
tabComponent() {
|
tabComponent() {
|
||||||
@ -36,9 +34,9 @@ export const SeriesColorPickerPopover: FunctionComponent<SeriesColorPickerPopove
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}}
|
}
|
||||||
/>
|
: undefined;
|
||||||
);
|
return <ColorPickerPopover {...colorPickerProps} color={color || '#000000'} customPickers={customPickers} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface AxisSelectorProps {
|
interface AxisSelectorProps {
|
||||||
|
@ -27,7 +27,6 @@ export const VizLegendListItem: React.FunctionComponent<Props> = ({ item, onSeri
|
|||||||
onSeriesColorChange(item.label, color);
|
onSeriesColorChange(item.label, color);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
yAxis={item.yAxis}
|
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
onClick={event => {
|
onClick={event => {
|
||||||
|
@ -5,28 +5,14 @@ import { SeriesIcon } from './SeriesIcon';
|
|||||||
interface Props {
|
interface Props {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
color: string;
|
color: string;
|
||||||
yAxis: number;
|
|
||||||
onColorChange: (color: string) => void;
|
onColorChange: (color: string) => void;
|
||||||
onToggleAxis?: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const VizLegendSeriesIcon: React.FunctionComponent<Props> = ({
|
export const VizLegendSeriesIcon: React.FunctionComponent<Props> = ({ disabled, color, onColorChange }) => {
|
||||||
disabled,
|
|
||||||
yAxis,
|
|
||||||
color,
|
|
||||||
onColorChange,
|
|
||||||
onToggleAxis,
|
|
||||||
}) => {
|
|
||||||
return disabled ? (
|
return disabled ? (
|
||||||
<SeriesIcon color={color} />
|
<SeriesIcon color={color} />
|
||||||
) : (
|
) : (
|
||||||
<SeriesColorPicker
|
<SeriesColorPicker color={color} onChange={onColorChange} enableNamedColors>
|
||||||
yaxis={yAxis}
|
|
||||||
color={color}
|
|
||||||
onChange={onColorChange}
|
|
||||||
onToggleAxis={onToggleAxis}
|
|
||||||
enableNamedColors
|
|
||||||
>
|
|
||||||
{({ ref, showColorPicker, hideColorPicker }) => (
|
{({ ref, showColorPicker, hideColorPicker }) => (
|
||||||
<SeriesIcon
|
<SeriesIcon
|
||||||
color={color}
|
color={color}
|
||||||
|
@ -35,7 +35,6 @@ export const LegendTableItem: React.FunctionComponent<Props> = ({
|
|||||||
onSeriesColorChange(item.label, color);
|
onSeriesColorChange(item.label, color);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
yAxis={item.yAxis}
|
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
onClick={event => {
|
onClick={event => {
|
||||||
|
Loading…
Reference in New Issue
Block a user