Changed default legend position
This commit is contained in:
@@ -885,8 +885,7 @@ function Legend(p: { props: ChartProps; legend: ChartLegend | null; colorOf: (i:
|
|||||||
// row under the plot. An explicit ChartLegend picks the row/column axis (orientation)
|
// row under the plot. An explicit ChartLegend picks the row/column axis (orientation)
|
||||||
// and where along it the legend sits (position).
|
// and where along it the legend sits (position).
|
||||||
const containerClass = () => {
|
const containerClass = () => {
|
||||||
const cfg = p.legend;
|
const cfg = p.legend ?? {orientation: "horizontal", position: "bottom-center"};
|
||||||
if (!cfg) return "mt-3 flex flex-wrap items-center gap-x-4 gap-y-1.5";
|
|
||||||
if (cfg.orientation === "vertical") {
|
if (cfg.orientation === "vertical") {
|
||||||
const justify = cfg.position.startsWith("top") ? "justify-start"
|
const justify = cfg.position.startsWith("top") ? "justify-start"
|
||||||
: cfg.position.startsWith("bottom") ? "justify-end" : "justify-center";
|
: cfg.position.startsWith("bottom") ? "justify-end" : "justify-center";
|
||||||
|
|||||||
Reference in New Issue
Block a user