diff --git a/src/pages/charts/view/[id].tsx b/src/pages/charts/view/[id].tsx index 3923957..f09ed24 100644 --- a/src/pages/charts/view/[id].tsx +++ b/src/pages/charts/view/[id].tsx @@ -45,8 +45,10 @@ export const getServerSideProps: GetServerSideProps = async ( const Chart: NextPage = ({ question, history }) => { return ( -
- +
+
+ +
); diff --git a/src/web/display/HistoryChart.tsx b/src/web/display/HistoryChart.tsx index b81184e..7180fdc 100644 --- a/src/web/display/HistoryChart.tsx +++ b/src/web/display/HistoryChart.tsx @@ -33,10 +33,10 @@ const data0 = [ { date: 9, probability: 0.7 }, ]; -let l = 5; +let l = 50; const data = Array.from(Array(l).keys()).map((x) => ({ date: x, - probability: x / l, + probability: Math.abs(Math.sin((5 * x) / l)), })); let getDate = (x) => { @@ -51,105 +51,79 @@ let dataAsXy = data.map((datum) => ({ export const HistoryChart: React.FC = ({ question, history }) => { return ( - } - domain={{ - y: [0, 1], - }} - > - `${datum.x}: ${Math.round(datum.y * 100)}%`} - labelComponent={ - - } +
+ } + domain={{ + y: [0, 1], + }} > - - (active ? 3.75 : 3)} /> - - datum.date)} - tickCount={10} - tickFormat={dataAsXy.map((datum) => datum.x)} - style={{ - grid: { stroke: null, strokeWidth: 0.5 }, - }} - tickLabelComponent={ - - } - /> - `${x * 100}%`} - style={{ - grid: { stroke: "#D3D3D3", strokeWidth: 0.5 }, - }} - /> - + + `${datum.x}: ${Math.round(datum.y * 100)}%`} + labelComponent={ + + } + > + + (active ? 3.75 : 3)} /> + + datum.x)} + // tickFormat={dataAsXy.map((datum) => datum.x)} + tickCount={7} + style={{ + grid: { stroke: null, strokeWidth: 0.5 }, + }} + tickLabelComponent={ + + } + /> + `${x * 100}%`} + style={{ + grid: { stroke: "#D3D3D3", strokeWidth: 0.5 }, + }} + tickLabelComponent={ + + } + /> + +
); }; - -/* - } - > - ({ x: datum.date, y: datum.probability }))} - labels={data.map((datum) => `1%`)} - style={{ labels: { fill: "black", fontSize: 10 } }} - labelComponent={ - - } - > - - - - -*/