mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
* added bar chart boilerplate * added x/y manipulation * replaced x/y management to inner series preparer * added tests * moved axis inversion to all charts series * removed line and area * inverted labels ui * removed normalizer check, simplified inverted axes check * finished working hbar * minor review * added conditional title to YAxis * generalized horizontal chart for line charts, resetted state on globalSeriesType change * fixed updates * fixed updates to layout * fixed minor issues * removed right Y axis when axes inverted * ran prettier * fixed updater function conflict and misuse of getOptions * renamed inverted to swapped * created mappingtypes for swapped columns * removed unused import * minor polishing * improved series behaviour in h-bar * minor fix * added basic filter to ChartTypeSelect * final setup of filtered chart types * Update viz-lib/src/components/visualizations/editor/createTabbedEditor.jsx * added proptypes and renamed ChartTypeSelect props * Add missing import * fixed import, moved result array to global scope * merged import * clearer naming in ChartTypeSelect * better lodash map syntax * fixed global modification * moved result inside useMemo Co-authored-by: Gabriel Dutra <nesk.frz@gmail.com> Co-authored-by: Levko Kravets <levko.ne@gmail.com>
76 lines
2.3 KiB
JavaScript
76 lines
2.3 KiB
JavaScript
import React from "react";
|
|
import { Section, Switch } from "@/components/visualizations/editor";
|
|
import { EditorPropTypes } from "@/visualizations/prop-types";
|
|
|
|
import AxisSettings from "./AxisSettings";
|
|
|
|
export default function YAxisSettings({ options, onOptionsChange }) {
|
|
const [leftYAxis, rightYAxis] = options.yAxis;
|
|
|
|
return (
|
|
<React.Fragment>
|
|
<Section.Title>{!options.swappedAxes ? "Left Y Axis" : "X Axis"}</Section.Title>
|
|
|
|
<Section>
|
|
<AxisSettings
|
|
id="LeftYAxis"
|
|
features={{ range: true }}
|
|
options={leftYAxis}
|
|
onChange={axis => onOptionsChange({ yAxis: [axis, rightYAxis] })}
|
|
/>
|
|
</Section>
|
|
|
|
{options.globalSeriesType !== "heatmap" && !options.swappedAxes && (
|
|
<React.Fragment>
|
|
<Section.Title>Right Y Axis</Section.Title>
|
|
|
|
<Section>
|
|
<AxisSettings
|
|
id="RightYAxis"
|
|
features={{ range: true }}
|
|
options={rightYAxis}
|
|
onChange={axis => onOptionsChange({ yAxis: [leftYAxis, axis] })}
|
|
/>
|
|
</Section>
|
|
|
|
<Section>
|
|
<Switch
|
|
id="chart-editor-y-axis-align-at-zero"
|
|
data-test="Chart.YAxis.AlignAtZero"
|
|
defaultChecked={options.alignYAxesAtZero}
|
|
onChange={alignYAxesAtZero => onOptionsChange({ alignYAxesAtZero })}>
|
|
Align Y Axes at Zero
|
|
</Switch>
|
|
</Section>
|
|
</React.Fragment>
|
|
)}
|
|
|
|
{options.globalSeriesType === "heatmap" && (
|
|
<React.Fragment>
|
|
<Section>
|
|
<Switch
|
|
id="chart-editor-y-axis-sort"
|
|
data-test="Chart.LeftYAxis.Sort"
|
|
defaultChecked={options.sortY}
|
|
onChange={sortY => onOptionsChange({ sortY })}>
|
|
Sort Values
|
|
</Switch>
|
|
</Section>
|
|
|
|
<Section>
|
|
<Switch
|
|
id="chart-editor-y-axis-reverse"
|
|
data-test="Chart.LeftYAxis.Reverse"
|
|
defaultChecked={options.reverseY}
|
|
onChange={reverseY => onOptionsChange({ reverseY })}>
|
|
Reverse Order
|
|
</Switch>
|
|
</Section>
|
|
</React.Fragment>
|
|
)}
|
|
</React.Fragment>
|
|
);
|
|
}
|
|
|
|
YAxisSettings.propTypes = EditorPropTypes;
|