|
@@ -59,10 +59,13 @@ async function getCXPC(ticker: string, cx: string): Promise<PriceChartPoint[]> {
|
|
|
|
|
|
|
|
function renderPriceChart(cx: string, dateRange: [Date, Date], maxPrice: number, maxTraded: number, cxpc: PriceChartPoint[]):
|
|
function renderPriceChart(cx: string, dateRange: [Date, Date], maxPrice: number, maxTraded: number, cxpc: PriceChartPoint[]):
|
|
|
SVGSVGElement | HTMLElement {
|
|
SVGSVGElement | HTMLElement {
|
|
|
|
|
+ const chartsWidth = charts.getBoundingClientRect().width;
|
|
|
return Plot.plot({
|
|
return Plot.plot({
|
|
|
grid: true,
|
|
grid: true,
|
|
|
- width: charts.getBoundingClientRect().width / 2 - 10,
|
|
|
|
|
|
|
+ width: chartsWidth < 600 ? chartsWidth : chartsWidth / 2 - 10,
|
|
|
height: 400,
|
|
height: 400,
|
|
|
|
|
+ marginLeft: 12 + 7 * Math.log10(maxPrice),
|
|
|
|
|
+ marginRight: 12 + 7 * Math.log10(maxTraded),
|
|
|
x: {domain: dateRange},
|
|
x: {domain: dateRange},
|
|
|
y: {axis: 'left', label: cx, domain: [0, maxPrice * 1.1]},
|
|
y: {axis: 'left', label: cx, domain: [0, maxPrice * 1.1]},
|
|
|
marks: [
|
|
marks: [
|