Highstock-单击点并传递ID时打开模态

时间:2018-12-03 15:22:43

标签: asp.net-mvc-4 razor highcharts

我有以下代码 https://jsfiddle.net/MarkDavies/nz4mv60g/20/

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<script src="https://code.highcharts.com/stock/modules/boost.js"></script>
<script src="https://code.highcharts.com/stock/modules/export-data.js"></script>

<div id="container" style="height: 400px; min-width: 310px"></div>

var data = [
  [1480948200000, 109.11, 3512],
  [1481034600000, 109.95, 3512],
  [1481121000000, 111.03, 3512],
  [1481207400000, 112.12, 3512],
  [1481293800000, 113.95, 3512],
  [1481553000000, 113.3, 3512],
  [1481639400000, 115.19, 3512],
  [1481725800000, 115.19, 3512],
  [1481812200000, 115.82, 3512],
  [1481898600000, 115.97, 3512],
  [1482157800000, 116.64, 3512],
  [1482244200000, 116.95, 3512],
  [1482330600000, 117.06, 3512],
  [1482417000000, 116.29, 3512],
  [1482503400000, 116.52, 3512],
  [1482849000000, 117.26, 3512],
  [1482935400000, 116.76, 3512],
  [1483021800000, 116.73, 3512],
  [1483108200000, 115.82, 3512],
  [1483453800000, 116.15, 3512],
  [1483540200000, 116.02, 3512],
  [1483626600000, 116.61, 3512],
  [1483713000000, 117.91, 3512],
  [1483972200000, 118.99, 3512],
  [1484058600000, 119.11, 3512],
  [1484145000000, 119.75, 3512],
  [1484231400000, 119.25, 3512],
  [1484317800000, 119.04, 3512],
  [1484663400000, 120, 3512],
  [1484749800000, 119.99, 3512],
  [1484836200000, 119.78, 3512],
  [1484922600000, 120, 3512],
  [1485181800000, 120.08, 3512],
  [1485268200000, 119.97, 3512],
  [1485354600000, 121.88, 3512],
  [1485441000000, 121.94, 3512],
  [1485527400000, 121.95, 3512],
  [1485786600000, 121.63, 3512],
  [1485873000000, 121.35, 3512],
  [1485959400000, 128.75, 3512],
  [1486045800000, 128.53, 3512],
  [1486132200000, 129.08, 3512],
  [1486391400000, 130.29, 3512],
  [1486477800000, 131.53, 3512],
  [1486564200000, 132.04, 3512],
  [1486650600000, 132.42, 3512],
  [1486737000000, 132.12, 3512],
  [1486996200000, 133.29, 3512],
  [1487082600000, 135.02, 3512],
  [1487169000000, 135.51, 3512],
  [1487255400000, 135.35, 3512],
  [1487341800000, 135.72, 3512],
  [1487687400000, 136.7, 3512],
  [1487773800000, 137.11, 3512],
  [1487860200000, 136.53, 3512],
  [1487946600000, 136.66, 3512],
  [1488205800000, 136.93, 3512],
  [1488292200000, 136.99, 3512],
  [1488378600000, 139.79, 3512],
  [1488465000000, 138.96, 3512],
  [1488551400000, 139.78, 3512],
  [1488810600000, 139.34, 3512],
  [1488897000000, 139.52, 3512],
  [1488983400000, 139, 3512],
  [1489069800000, 138.68, 3512],
  [1489156200000, 139.14, 3512],
  [1489411800000, 139.2, 3512],
  [1489498200000, 138.99, 3512],
  [1489584600000, 140.46, 3512],
  [1489671000000, 140.69, 3512],
  [1489757400000, 139.99, 3512],
  [1490016600000, 141.46, 3512],
  [1490103000000, 139.84, 3512],
  [1490189400000, 141.42, 3512],
  [1490275800000, 140.92, 3512],
  [1490362200000, 140.64, 3512],
  [1490621400000, 140.88, 3512],
  [1490707800000, 143.8, 3512],
  [1490794200000, 144.12, 3512],
  [1490880600000, 143.93, 3512],
  [1490967000000, 143.66, 3512],
  [1491226200000, 143.7, 3512],
  [1491312600000, 144.77, 3512],
  [1491399000000, 144.02, 3512],
  [1491485400000, 143.66, 3512],
  [1491571800000, 143.34, 3512],
  [1491831000000, 143.17, 3512],
  [1491917400000, 141.63, 3512],
  [1492003800000, 141.8, 3512],
  [1492090200000, 141.05, 3512],
  [1492435800000, 141.83, 3512],
  [1492522200000, 141.2, 3512],
  [1492608600000, 140.68, 3512],
  [1492695000000, 142.44, 3512],
  [1492781400000, 142.27, 3512],
  [1493040600000, 143.64, 3512],
  [1493127000000, 144.53, 3512],
  [1493213400000, 143.68, 3512],
  [1493299800000, 143.79, 3512],
  [1493386200000, 143.65, 3512],
  [1493645400000, 146.58, 3512],
  [1493731800000, 147.51, 3512],
  [1493818200000, 147.06, 3512],
  [1493904600000, 146.53, 3512],
  [1493991000000, 148.96, 3512],
  [1494250200000, 153.01, 3512],
  [1494336600000, 153.99, 3512],
  [1494423000000, 153.26, 3512],
  [1494509400000, 153.95, 3512],
  [1494595800000, 156.1, 3512],
  [1494855000000, 155.7, 3512],
  [1494941400000, 155.47, 3512],
  [1495027800000, 150.25, 3512],
  [1495114200000, 152.54, 3512],
  [1495200600000, 153.06, 3512],
  [1495459800000, 153.99, 3512],
  [1495546200000, 153.8, 3512],
  [1495632600000, 153.34, 3512],
  [1495719000000, 153.87, 3512],
  [1495805400000, 153.61, 3512],
  [1496151000000, 153.67, 3512],
  [1496237400000, 152.76, 3512],
  [1496323800000, 153.18, 3512],
  [1496410200000, 155.45, 3512],
  [1496669400000, 153.93, 3512],
  [1496755800000, 154.45, 3512],
  [1496842200000, 155.37, 3512],
  [1496928600000, 154.99, 3512],
  [1497015000000, 148.98, 3512],
  [1497274200000, 145.42, 3512],
  [1497360600000, 146.59, 3512],
  [1497447000000, 145.16, 3512],
  [1497533400000, 144.29, 3512],
  [1497619800000, 142.27, 3512],
  [1497879000000, 146.34, 3512],
  [1497965400000, 145.01, 3512],
  [1498051800000, 145.87, 3512],
  [1498138200000, 145.63, 3512],
  [1498224600000, 146.28, 3512],
  [1498483800000, 145.82, 3512],
  [1498570200000, 143.73, 3512],
  [1498656600000, 145.83, 3512],
  [1498743000000, 143.68, 3512],
  [1498829400000, 144.02, 3512],
  [1499088600000, 143.5, 3512],
  [1499261400000, 144.09, 3512],
  [1499347800000, 142.73, 3512],
  [1499434200000, 144.18, 3512],
  [1499693400000, 145.06, 3512],
  [1499779800000, 145.53, 3512],
  [1499866200000, 145.74, 3512],
  [1499952600000, 147.77, 3512],
  [1500039000000, 149.04, 3512],
  [1500298200000, 149.56, 3512],
  [1500384600000, 150.08, 3512],
  [1500471000000, 151.02, 3512],
  [1500557400000, 150.34, 3512],
  [1500643800000, 150.27, 3512],
  [1500903000000, 152.09, 3512],
  [1500989400000, 152.74, 3512],
  [1501075800000, 153.46, 3512],
  [1501162200000, 150.56, 3512],
  [1501248600000, 149.5, 3512],
  [1501507800000, 148.73, 3512],
  [1501594200000, 150.05, 3512],
  [1501680600000, 157.14, 3512],
  [1501767000000, 155.57, 3512],
  [1501853400000, 156.39, 3512],
  [1502112600000, 158.81, 3512],
  [1502199000000, 160.08, 3512],
  [1502285400000, 161.06, 3512],
  [1502371800000, 155.32, 3512],
  [1502458200000, 157.48, 3512],
  [1502717400000, 159.85, 3512],
  [1502803800000, 161.6, 3512],
  [1502890200000, 160.95, 3512],
  [1502976600000, 157.86, 3512],
  [1503063000000, 157.5, 3512],
  [1503322200000, 157.21, 3512],
  [1503408600000, 159.78, 3512],
  [1503495000000, 159.98, 3512],
  [1503581400000, 159.27, 3512],
  [1503667800000, 159.86, 3512],
  [1503927000000, 161.47, 3512],
  [1504013400000, 162.91, 3512],
  [1504099800000, 163.35, 3512],
  [1504186200000, 164, 3512],
  [1504272600000, 164.05, 3512],
  [1504618200000, 162.08, 3512],
  [1504704600000, 161.91, 3512],
  [1504791000000, 161.26, 3512],
  [1504877400000, 158.63, 3512],
  [1505136600000, 161.5, 3512],
  [1505223000000, 160.86, 3512],
  [1505309400000, 159.65, 3512],
  [1505395800000, 158.28, 3512],
  [1505482200000, 159.88, 3512],
  [1505741400000, 158.67, 3512],
  [1505827800000, 158.73, 3512],
  [1505914200000, 156.07, 3512],
  [1506000600000, 153.39, 3512],
  [1506087000000, 151.89, 3512],
  [1506346200000, 150.55, 3512],
  [1506432600000, 153.14, 3512],
  [1506519000000, 154.23, 3512],
  [1506605400000, 153.28, 3512],
  [1506691800000, 154.12, 3512],
  [1506951000000, 153.81, 3512],
  [1507037400000, 154.48, 3512],
  [1507123800000, 153.48, 3512],
  [1507210200000, 155.39, 3512],
  [1507296600000, 155.3, 3512],
  [1507555800000, 155.84, 3512],
  [1507642200000, 155.9, 3512],
  [1507728600000, 156.55, 3512],
  [1507815000000, 156, 3512],
  [1507901400000, 156.99, 3512],
  [1508160600000, 159.88, 3512],
  [1508247000000, 160.47, 3512],
  [1508333400000, 159.76, 3512],
  [1508419800000, 155.98, 3512],
  [1508506200000, 156.25, 3512],
  [1508765400000, 156.17, 3512],
  [1508851800000, 157.1, 3512],
  [1508938200000, 156.41, 3512],
  [1509024600000, 157.41, 3512],
  [1509111000000, 163.05, 3512],
  [1509370200000, 166.72, 3512],
  [1509456600000, 169.04, 3512],
  [1509543000000, 166.89, 3512],
  [1509629400000, 168.11, 3512],
  [1509715800000, 172.5, 3512],
  [1509978600000, 174.25, 3512],
  [1510065000000, 174.81, 3512],
  [1510151400000, 176.24, 3512],
  [1510237800000, 175.88, 3512],
  [1510324200000, 174.67, 3512],
  [1510583400000, 173.97, 3512],
  [1510669800000, 171.34, 3512],
  [1510756200000, 169.08, 3512],
  [1510842600000, 171.1, 3512],
  [1510929000000, 170.15, 3512],
  [1511188200000, 169.98, 3512],
  [1511274600000, 173.14, 3512],
  [1511361000000, 174.96, 3512],
  [1511533800000, 174.97, 3512],
  [1511793000000, 174.09, 3512],
  [1511879400000, 173.07, 3512],
  [1511965800000, 169.48, 3512],
  [1512052200000, 171.85, 3512],
  [1512138600000, 171.05, 3512],
  [1512397800000, 169.8, 3512],
  [1512484200000, 169.64, 3512],
  [1512570600000, 169.01, 3512],
  [1512657000000, 169.32, 3512],
  [1512743400000, 169.37, 3512],
  [1513002600000, 172.67, 3512],
  [1513089000000, 171.7, 3512],
  [1513175400000, 172.27, 3512],
  [1513261800000, 172.22, 3512],
  [1513348200000, 173.97, 3512],
  [1513607400000, 176.42, 3512],
  [1513693800000, 174.54, 3512],
  [1513780200000, 174.35, 3512],
  [1513866600000, 175.01, 3512],
  [1513953000000, 175.01, 3512],
  [1514298600000, 170.57, 3512],
  [1514385000000, 170.6, 3512],
  [1514471400000, 171.08, 3512],
  [1514557800000, 169.23, 3512],
  [1514903400000, 172.26, 3512],
  [1514989800000, 172.23, 3512],
  [1515076200000, 173.03, 3512],
  [1515162600000, 175, 3512],
  [1515421800000, 174.35, 3512],
  [1515508200000, 174.33, 3512],
  [1515594600000, 174.29, 3512],
  [1515681000000, 175.28, 3512],
  [1515767400000, 177.09, 3512],
  [1516113000000, 176.19, 3512],
  [1516199400000, 179.1, 3512],
  [1516285800000, 179.26, 3512],
  [1516372200000, 178.46, 3512],
  [1516631400000, 177, 3512],
  [1516717800000, 177.04, 3512],
  [1516804200000, 174.22, 3512],
  [1516890600000, 171.11, 3512],
  [1516977000000, 171.51, 3512],
  [1517236200000, 167.96, 3512],
  [1517322600000, 166.97, 3512],
  [1517409000000, 167.43, 3512],
  [1517495400000, 167.78, 3512],
  [1517581800000, 160.5, 3512],
  [1517841000000, 156.49, 3512],
  [1517927400000, 163.03, 3512],
  [1518013800000, 159.54, 3512],
  [1518100200000, 155.15, 3512],
  [1518186600000, 156.41, 3512],
  [1518445800000, 162.71, 3512],
  [1518532200000, 164.34, 3512],
  [1518618600000, 167.37, 3512],
  [1518705000000, 172.99, 3512],
  [1518791400000, 172.43, 3512],
  [1519137000000, 171.85, 3512],
  [1519223400000, 171.07, 3512],
  [1519309800000, 172.5, 3512],
  [1519396200000, 175.5, 3512],
  [1519655400000, 178.97, 3512],
  [1519741800000, 178.39, 3512],
  [1519828200000, 178.12, 3512],
  [1519914600000, 175, 3512],
  [1520001000000, 176.21, 3512],
  [1520260200000, 176.82, 3512],
  [1520346600000, 176.67, 3512],
  [1520433000000, 175.03, 3512],
  [1520519400000, 176.94, 3512],
  [1520605800000, 179.98, 3512],
  [1520861400000, 181.72, 3512],
  [1520947800000, 179.97, 3512],
  [1521034200000, 178.44, 3512],
  [1521120600000, 178.65, 3512],
  [1521207000000, 178.02, 3512],
  [1521466200000, 175.3, 3512],
  [1521552600000, 175.24, 3512],
  [1521639000000, 171.27, 3512],
  [1521725400000, 168.85, 3512],
  [1521811800000, 164.94, 3512],
  [1522071000000, 172.77, 3512],
  [1522157400000, 168.34, 3512],
  [1522243800000, 166.48, 3512],
  [1522330200000, 167.78, 3512],
  [1522675800000, 166.68, 3512],
  [1522762200000, 168.39, 3512],
  [1522848600000, 171.61, 3512],
  [1522935000000, 172.8, 3512],
  [1523021400000, 168.38, 3512],
  [1523280600000, 170.05, 3512],
  [1523367000000, 173.25, 3512],
  [1523453400000, 172.44, 3512],
  [1523539800000, 174.14, 3512],
  [1523626200000, 174.73, 3512],
  [1523885400000, 175.82, 3512],
  [1523971800000, 178.24, 3512],
  [1524058200000, 177.84, 3512],
  [1524144600000, 172.8, 3512],
  [1524231000000, 165.72, 3512],
  [1524490200000, 165.24, 3512],
  [1524576600000, 162.94, 3512],
  [1524663000000, 163.65, 3512],
  [1524749400000, 164.22, 3512],
  [1524835800000, 162.32, 3512],
  [1525095000000, 165.26, 3512],
  [1525181400000, 169.1, 3512],
  [1525267800000, 176.57, 3512],
  [1525354200000, 176.89, 3512],
  [1525440600000, 183.83, 3512],
  [1525699800000, 185.16, 3512],
  [1525786200000, 186.05, 3512],
  [1525872600000, 187.36, 3512],
  [1525959000000, 190.04, 3512],
  [1526045400000, 188.59, 3512],
  [1526304600000, 188.15, 3512],
  [1526391000000, 186.44, 3512],
  [1526477400000, 188.18, 3512],
  [1526563800000, 186.99, 3512],
  [1526650200000, 186.31, 3512],
  [1526909400000, 187.63, 3512],
  [1526995800000, 187.16, 3512],
  [1527082200000, 188.36, 3512],
  [1527168600000, 188.15, 3512],
  [1527255000000, 188.58, 3512],
  [1527600600000, 187.9, 3512],
  [1527687000000, 187.5, 3512],
  [1527773400000, 186.87, 3512],
  [1527859800000, 190.24, 3512],
  [1528119000000, 191.83, 3512],
  [1528205400000, 193.31, 3512],
  [1528291800000, 193.98, 3512],
  [1528378200000, 193.46, 3512],
  [1528464600000, 191.7, 3512],
  [1528723800000, 191.23, 3512],
  [1528810200000, 192.28, 3512],
  [1528896600000, 190.7, 3512],
  [1528983000000, 190.8, 3512],
  [1529069400000, 188.84, 3512],
  [1529328600000, 188.74, 3512],
  [1529415000000, 185.69, 3512],
  [1529501400000, 186.5, 3512],
  [1529587800000, 185.46, 3512],
  [1529674200000, 184.92, 3512],
  [1529933400000, 182.17, 3512],
  [1530019800000, 184.43, 3512],
  [1530106200000, 184.16, 3512],
  [1530192600000, 185.5, 3512],
  [1530279000000, 185.11, 3512],
  [1530538200000, 187.18, 3512],
  [1530624600000, 183.92, 3512],
  [1530797400000, 185.4, 3512],
  [1530883800000, 187.97, 3512],
  [1531143000000, 190.58, 3512],
  [1531229400000, 190.35, 3512],
  [1531315800000, 187.88, 3512],
  [1531402200000, 191.03, 3512],
  [1531488600000, 191.33, 3512],
  [1531747800000, 190.91, 3512],
  [1531834200000, 191.45, 3512],
  [1531920600000, 190.4, 3512],
  [1532007000000, 191.88, 3512],
  [1532093400000, 191.44, 3512],
  [1532352600000, 191.61, 3512],
  [1532439000000, 193, 3512],
  [1532525400000, 194.82, 3512],
  [1532611800000, 194.21, 3512],
  [1532698200000, 190.98, 3512],
  [1532957400000, 189.91, 3512],
  [1533043800000, 190.29, 3512],
  [1533130200000, 201.5, 3512],
  [1533216600000, 207.39, 3512],
  [1533303000000, 207.99, 3512],
  [1533562200000, 209.07, 3512],
  [1533648600000, 207.11, 3512],
  [1533735000000, 207.25, 3512],
  [1533821400000, 208.88, 3512],
  [1533907800000, 207.53, 3512],
  [1534167000000, 208.87, 3512],
  [1534253400000, 209.75, 3512],
  [1534339800000, 210.24, 3512],
  [1534426200000, 213.32, 3512],
  [1534512600000, 217.58, 3512],
  [1534771800000, 215.46, 3512],
  [1534858200000, 215.04, 3512],
  [1534944600000, 215.05, 3512],
  [1535031000000, 215.49, 3512],
  [1535117400000, 216.16, 3512],
  [1535376600000, 217.94, 3512],
  [1535463000000, 219.7, 3512],
  [1535549400000, 222.98, 3512],
  [1535635800000, 225.03, 3512],
  [1535722200000, 227.63, 3512],
  [1536067800000, 228.36, 3512],
  [1536154200000, 226.87, 3512],
  [1536240600000, 223.1, 3512],
  [1536327000000, 221.3, 3512],
  [1536586200000, 218.33, 3512],
  [1536672600000, 223.85, 3512],
  [1536759000000, 221.07, 3512],
  [1536845400000, 226.41, 3512],
  [1536931800000, 223.84, 3512],
  [1537191000000, 217.88, 3512],
  [1537277400000, 218.24, 3512],
  [1537363800000, 218.37, 3512],
  [1537450200000, 220.03, 3512],
  [1537536600000, 217.66, 3512],
  [1537795800000, 220.79, 3512],
  [1537882200000, 222.19, 3512],
  [1537968600000, 220.42, 3512],
  [1538055000000, 224.95, 3512],
  [1538141400000, 225.74, 3512],
  [1538400600000, 227.26, 3512],
  [1538487000000, 229.28, 3512],
  [1538573400000, 232.07, 3512],
  [1538659800000, 227.99, 3512],
  [1538746200000, 224.29, 3512],
  [1539005400000, 223.77, 3512],
  [1539091800000, 226.87, 3512],
  [1539178200000, 216.36, 3512],
  [1539264600000, 214.45, 3512],
  [1539351000000, 222.11, 3512],
  [1539610200000, 217.36, 3512],
  [1539696600000, 222.15, 3512],
  [1539783000000, 221.19, 3512],
  [1539869400000, 216.02, 3512],
  [1539955800000, 219.31, 3512],
  [1540215000000, 220.65, 3512],
  [1540301400000, 222.73, 3512],
  [1540387800000, 215.09, 3512],
  [1540474200000, 219.8, 3512],
  [1540560600000, 216.3, 3512],
  [1540819800000, 212.24, 3512],
  [1540906200000, 213.3, 3512],
  [1540992600000, 218.86, 3512],
  [1541079000000, 222.22, 3512],
  [1541165400000, 207.48, 3512],
  [1541428200000, 201.59, 3512],
  [1541514600000, 203.77, 3512],
  [1541601000000, 209.95, 3512],
  [1541687400000, 208.49, 3512],
  [1541773800000, 204.47, 3512],
  [1542033000000, 194.17, 3512],
  [1542119400000, 192.23, 3512],
  [1542205800000, 186.8, 3512],
  [1542292200000, 191.41, 3512],
  [1542378600000, 193.53, 3512],
  [1542637800000, 185.86, 3512],
  [1542724200000, 176.98, 3512],
  [1542810600000, 176.78, 3512],
  [1542983400000, 172.29, 3512],
  [1543242600000, 174.62, 3512],
  [1543329000000, 174.24, 3512],
  [1543415400000, 180.94, 3512],
  [1543501800000, 179.55, 3512],
  [1543588200000, 178.58, 3512]
]


// Create the chart
Highcharts.stockChart('container', {


  rangeSelector: {
    selected: 1
  },

  title: {
    text: 'AAPL Stock Price'
  },

  series: [{
    turboThreshold: 10,
    name: 'AAPL',
    data: data,
    keys: ['x', 'y', 'sepcialId'],
    tooltip: {
      valueDecimals: 2,
      pointFormat: '<span style="color:{point.color}">●</span> {series.name}: <b>{point.y}</b>, ID:             {point.special-id}<br/>.'
    },

     point: {
       events: {
         click: function () {
         console.log(this)
           window.open('http://Google.com?id=' + this.sepcialId, '_blank');
         }
       }
     }
  }]
});

如果您单击一个点,它将打开一个新窗口并输入所选项目的ID

我想弹出一个模式,而不是新的窗口/ URL,并将ID传递到该模式 然后,我将使用asp.net MVC获取所需的内容并显示给用户

我已经在项目中使用了引导程序。 使用高图可以做到吗?如果可以,怎么办?

0 个答案:

没有答案