mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-06 09:22:26 +00:00
* feat: experimenting tables with react * feat: adding new interactive tables * feat: adding more table features * small changes * update * Update backend.py * Update backend.py * fix: dark mode? * feat: lot of table improvements * fix: my b * fix: load only when prod * feat: naive detect links and dates * handle index and column names * increased min width * codespell * mypy, pylint * fix: added new chart, export, etc * testing * updates * fix : add PLOT_OPEN_EXPORT, USE_INTERACTIVE_DF to user dataclass * bump pywry version, readd removed `plots_backend().start()` * req files * Update unit-test.yml * Update unit-test.yml * Update unit-test.yml * updates * fixing some date things * update table * fix formatting with timezones * fixing some long prints and tables * Mickey Mouse Co-authored-by: teh_coderer <tehcoderer@users.noreply.github.com> Co-authored-by: jose-donato <jose-donato@users.noreply.github.com> * fix: ?!?!? * adding limit arg to all print_rich_table * tests * lint * simple by Default on interactive charts * playing with some css (thks jose) * Fix #4426 * Edit some structure * fix sdk generation * Update backend.py * fa menu tested and working * fix #4460 * fix #4460 drop indices * update tests * update tests * Update helper_funcs.py * tests * Update unit-test.yml * Update etf.ipynb --------- Co-authored-by: teh_coderer <me@tehcoderer.com> Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com> Co-authored-by: teh_coderer <tehcoderer@users.noreply.github.com> Co-authored-by: jose-donato <jose-donato@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com>
113 lines
1.9 KiB
TypeScript
Vendored
113 lines
1.9 KiB
TypeScript
Vendored
//@ts-ignore
|
|
import Plot from "react-plotly.js";
|
|
|
|
const COLORS = [
|
|
"rgb(31,119,180)",
|
|
"rgb(255,127,14)",
|
|
"rgb(44,160,44)",
|
|
"rgb(214,39,40)",
|
|
"rgb(148,103,189)",
|
|
"rgb(140,86,75)",
|
|
"rgb(227,119,194)",
|
|
"rgb(127,127,127)",
|
|
];
|
|
|
|
const plot_layout = {
|
|
height: window.innerHeight * 0.7,
|
|
width: window.innerWidth * 0.8,
|
|
font: {
|
|
color: "#F5EFF3",
|
|
size: 16,
|
|
},
|
|
annotationdefaults: {
|
|
showarrow: false,
|
|
},
|
|
autotypenumbers: "strict",
|
|
colorway: [
|
|
"#ffed00",
|
|
"#ef7d00",
|
|
"#e4003a",
|
|
"#c13246",
|
|
"#822661",
|
|
"#48277c",
|
|
"#005ca9",
|
|
"#00aaff",
|
|
"#9b30d9",
|
|
"#af005f",
|
|
"#5f00af",
|
|
"#af87ff",
|
|
],
|
|
xaxis: {
|
|
automargin: true,
|
|
autorange: true,
|
|
rangeslider: {
|
|
visible: false,
|
|
},
|
|
showgrid: true,
|
|
showline: true,
|
|
tickfont: {
|
|
size: 14,
|
|
},
|
|
zeroline: false,
|
|
tick0: 1,
|
|
title: {
|
|
standoff: 20,
|
|
},
|
|
linecolor: "#F5EFF3",
|
|
mirror: true,
|
|
ticks: "outside",
|
|
},
|
|
yaxis: {
|
|
anchor: "x",
|
|
automargin: true,
|
|
fixedrange: false,
|
|
zeroline: false,
|
|
showgrid: true,
|
|
showline: true,
|
|
side: "right",
|
|
tick0: 0.5,
|
|
title: {
|
|
standoff: 20,
|
|
},
|
|
gridcolor: "#283442",
|
|
linecolor: "#F5EFF3",
|
|
mirror: true,
|
|
ticks: "outside",
|
|
},
|
|
plot_bgcolor: "rgba(0,0,0,1)",
|
|
paper_bgcolor: "rgba(0,0,0,1)",
|
|
dragmode: "pan",
|
|
};
|
|
|
|
|
|
export default function Chart({ values }: { values: number[][] }) {
|
|
if (!values) return null;
|
|
console.log(values);
|
|
const data = values.map((value, idx) => ({
|
|
x: value.map((_, i) => i),
|
|
y: value,
|
|
type: "bar",
|
|
showlegend: false,
|
|
marker: {
|
|
color: COLORS[idx],
|
|
opacity: 0.6,
|
|
line: {
|
|
color: COLORS[idx],
|
|
width: 1.5,
|
|
},
|
|
},
|
|
}));
|
|
console.log(data);
|
|
return (
|
|
<Plot
|
|
data={data}
|
|
layout={plot_layout}
|
|
config={{
|
|
displaylogo: false,
|
|
responsive: true,
|
|
scrollZoom: true,
|
|
}}
|
|
/>
|
|
);
|
|
}
|