1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Graph Prompting Research Trend</title> <script src="https://cdn.plot.ly/plotly-2.35.2.min.js" charset="utf-8" ></script> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 0; } .card { width: 100%; max-width: 800px; margin: auto; border: 1px solid #ccc; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); } .card-header { background: #f5f5f5; padding: 16px; font-size: 1.5em; font-weight: bold; } .card-content { padding: 0; } .chart-container { width: 100%; height: 400px; } </style> </head> <body> <div class="card"> <div class="card-header">Graph Prompting Research Trend</div> <div class="card-content"> <div id="chart" class="chart-container"></div> </div> </div>
<script> const data = [ { month: "2022-09", papers: 1 }, { month: "2023-02", papers: 1 }, { month: "2023-03", papers: 1 }, { month: "2023-07", papers: 1 }, { month: "2023-08", papers: 5 }, { month: "2023-09", papers: 2 }, { month: "2023-10", papers: 2 }, { month: "2023-11", papers: 2 }, { month: "2023-12", papers: 1 }, { month: "2024-02", papers: 2 }, { month: "2024-03", papers: 1 }, { month: "2024-04", papers: 2 }, { month: "2024-05", papers: 3 }, { month: "2024-06", papers: 3 }, { month: "2024-07", papers: 2 }, { month: "2024-08", papers: 5 }, { month: "2024-09", papers: 2 }, { month: "2024-10", papers: 8 }, ];
const cumulativeData = data.map((item, index) => ({ month: item.month, cumulativePapers: data .slice(0, index + 1) .reduce((acc, cur) => acc + cur.papers, 0), papers: item.papers, }));
const trace1 = { x: cumulativeData.map((d) => d.month), y: cumulativeData.map((d) => d.cumulativePapers), type: "bar", name: "Cumulative Papers", marker: { color: "#8884d8" }, };
const trace2 = { x: data.map((d) => d.month), y: data.map((d) => d.papers), mode: "lines+markers", name: "Monthly Papers", line: { color: "#ff7300", width: 2 }, };
const layout = { title: "Graph Prompting Research Trend", xaxis: { title: "Month", tickangle: -45, }, yaxis: { title: "Number of Papers", titlefont: { size: 16 }, autorange: true, }, barmode: "overlay", };
Plotly.newPlot("chart", [trace1, trace2], layout); </script> </body> </html>
|