如何在工具提示中创建自定义日期并在highcharts中标记?

时间:2014-12-04 12:07:04

标签: javascript jquery highcharts highstock

我的数据格式如下:

{"01.12.10 00:00":-1.5821800231934,"01.12.10 00:05":-1.5570800304413,"01.12.10 00:10":-1.5885699987411,"01.12.10 00:15":-1.6257599592209,"01.12.10 00:20":-1.6307400465012,"01.12.10 00:25":-1.6432000398636,"01.12.10 00:30":-1.655179977417,"01.12.10 00:35":-1.646919965744,"01.12.10 00:40":-1.6347700357437,"01.12.10 00:45":-1.6490000486374,"01.12.10 00:50":-1.6404999494553,"01.12.10 00:55":-1.6160600185394,"01.12.10 01:00":-1.6089400053024,"01.12.10 01:05":-1.6082600355148,"01.12.10 01:10":-1.6159199476242,"01.12.10 01:15":-1.5781999826431,"01.12.10 01:20":-1.6013100147247,"01.12.10 01:25":-1.636440038681,"01.12.10 01:30":-1.6679799556732,"01.12.10 01:35":-1.6709300279617,"01.12.10 01:40":-1.7158499956131,"01.12.10 01:45":-1.7515499591827,"01.12.10 01:50":-1.7836400270462,"01.12.10 01:55":-1.7883299589157,"01.12.10 02:00":-1.8029299974442,"01.12.10 02:05":-1.8306200504303,"01.12.10 02:10":-1.8690099716187,"01.12.10 02:15":-1.8802800178528,"01.12.10 02:20":-1.890319943428,"01.12.10 02:25":-1.9045300483704,"01.12.10 02:30":-1.9173899888992,"01.12.10 02:35":-1.9262299537659,"01.12.10 02:40":-1.9494600296021,"01.12.10 02:45":-1.9754300117493,"01.12.10 02:50":-2.0177900791168,"01.12.10 02:55":-2.1353900432587,"01.12.10 03:00":-2.2930901050568,"01.12.10 03:05":-2.4463000297546,"01.12.10 03:10":-2.4375700950623,"01.12.10 03:15":-2.4210600852966,"01.12.10 03:20":-2.4662098884583,"01.12.10 03:25":-2.4880900382996,"01.12.10 03:30":-2.5205299854279,"01.12.10 03:35":-2.4987099170685,"01.12.10 03:40":-2.4680500030518,"01.12.10 03:45":-2.4702401161194,"01.12.10 03:50":-2.451080083847,"01.12.10 03:55":-2.4516499042511,"01.12.10 04:00":-2.4481599330902,"01.12.10 04:05":-2.4502699375153,"01.12.10 04:10":-2.4662299156189,"01.12.10 04:15":-2.5105600357056,"01.12.10 04:20":-2.50919008255,"01.12.10 04:25":-2.5130999088287,"01.12.10 04:30":-2.5451800823212,"01.12.10 04:35":-2.5562000274658,"01.12.10 04:40":-2.6259000301361,"01.12.10 04:45":-2.7309300899506,"01.12.10 04:50":-2.8319699764252,"01.12.10 04:55":-2.8631100654602,"01.12.10 05:00":-2.8928599357605,"01.12.10 05:05":-2.8894898891449,"01.12.10 05:10":-2.9616599082947,"01.12.10 05:15":-3.1418600082397,"01.12.10 05:20":-3.2685699462891,"01.12.10 05:25":-3.3137500286102,"01.12.10 05:30":-3.3353900909424,"01.12.10 05:35":-3.3902299404144,"01.12.10 05:40":-3.4585599899292,"01.12.10 05:45":-3.4444699287415,"01.12.10 05:50":-3.5108699798584,"01.12.10 05:55":-3.6601400375366,"01.12.10 06:00":-3.7696199417114,"01.12.10 06:05":-3.8631000518799,"01.12.10 06:10":-3.8658299446106,"01.12.10 06:15":-3.8384199142456,"01.12.10 06:20":-3.8950099945068,"01.12.10 06:25":-3.9381499290466,"01.12.10 06:30":-3.9554200172424,"01.12.10 06:35":-3.9999001026154,"01.12.10 06:40":-4.0711097717285,"01.12.10 06:45":-4.0509099960327,"01.12.10 06:50":-4.1715598106384,"01.12.10 06:55":-4.2333498001099,"01.12.10 07:00":-4.2430701255798,"01.12.10 07:05":-4.3055901527405,"01.12.10 07:10":-4.4034600257874,"01.12.10 07:15":-4.4389200210571,"01.12.10 07:20":-4.4868302345276,"01.12.10 07:25":-4.5518598556519,"01.12.10 07:30":-4.5963802337646,"01.12.10 07:35":-4.6814498901367,"01.12.10 07:40":-4.7725601196289,"01.12.10 07:45":-4.778480052948,"01.12.10 07:50":-4.7483201026917,"01.12.10 07:55":-4.7735900878906,"01.12.10 08:00":-4.7614998817444,"01.12.10 08:05":-4.6872401237488,"01.12.10 08:10":-4.6662797927856,"01.12.10 08:15":-4.6301298141479,"01.12.10 08:20":-4.6154198646545,"01.12.10 08:25":-4.5529398918152,"01.12.10 08:30":-4.5201001167297,"01.12.10 08:35":-4.5218000411987,"01.12.10 08:40":-4.5354599952698,"01.12.10 08:45":-4.5616898536682,"01.12.10 08:50":-4.5259799957275,"01.12.10 08:55":-4.5739998817444,"01.12.10 09:00":-4.544469833374,"01.12.10 09:05":-4.5953998565674,"01.12.10 09:10":-4.6031799316406,"01.12.10 09:15":-4.6317100524902,"01.12.10 09:20":-4.6038899421692,"01.12.10 09:25":-4.6373100280762,"01.12.10 09:30":-4.598090171814,"01.12.10 09:35":-4.630509853363,"01.12.10 09:40":-4.6451802253723,"01.12.10 09:45":-4.6168298721313,"01.12.10 09:50":-4.6147298812866,"01.12.10 09:55":-4.6291399002075,"01.12.10 10:00":-4.6206698417664,"01.12.10 10:05":-4.6168098449707,"01.12.10 10:10":-4.6577501296997,"01.12.10 10:15":-4.7136101722717,"01.12.10 10:20":-4.7641401290894,"01.12.10 10:25":-4.7707800865173,"01.12.10 10:30":-4.7958002090454,"01.12.10 10:35":-4.7481098175049,"01.12.10 10:40":-4.7468700408936,"01.12.10 10:45":-4.7955799102783,"01.12.10 10:50":-4.8291401863098,"01.12.10 10:55":-4.8085598945618,"01.12.10 11:00":-4.7263197898865,"01.12.10 11:05":-4.6961002349854,"01.12.10 11:10":-4.671639919281,"01.12.10 11:15":-4.6141700744629,"01.12.10 11:20":-4.5709600448608,"01.12.10 11:25":-4.5492100715637,"01.12.10 11:30":-4.456570148468,"01.12.10 11:35":-4.4159898757935,"01.12.10 11:40":-4.2619299888611,"01.12.10 11:45":-4.1498198509216,"01.12.10 11:50":-3.9666299819946,"01.12.10 11:55":-3.5223000049591,"01.12.10 12:00":-2.478049993515,"01.12.10 12:05":-0.56206297874451,"01.12.10 12:10":2.284600019455,"01.12.10 12:15":5.951690196991,"01.12.10 12:20":10.948699951172,"01.12.10 12:25":15.580699920654,"01.12.10 12:30":20.080499649048,"01.12.10 12:35":23.684799194336,"01.12.10 12:40":26.596200942993,"01.12.10 12:45":28.908500671387,"01.12.10 12:50":31.979499816895,"01.12.10 12:55":32.946998596191,"01.12.10 13:00":22.061199188232,"01.12.10 13:05":21.125799179077,"01.12.10 13:10":26.017499923706,"01.12.10 13:15":25.74049949646,"01.12.10 13:20":25.434099197388,"01.12.10 13:25":25.444299697876,"01.12.10 13:30":26.382999420166,"01.12.10 13:35":25.93090057373,"01.12.10 13:40":20.884000778198,"01.12.10 13:45":18.872699737549,"01.12.10 13:50":18.430200576782,"01.12.10 13:55":17.906000137329,"01.12.10 14:00":15.912799835205,"01.12.10 14:05":14.121000289917,"01.12.10 14:10":12.894800186157,"01.12.10 14:15":11.505399703979,"01.12.10 14:20":10.144800186157,"01.12.10 14:25":8.6375198364258,"01.12.10 14:30":7.185389995575,"01.12.10 14:35":6.3775501251221,"01.12.10 14:40":5.8926301002502,"01.12.10 14:45":5.1023101806641,"01.12.10 14:50":4.8646898269653,"01.12.10 14:55":4.8714799880981,"01.12.10 15:00":5.4538898468018,"01.12.10 15:05":6.8286600112915,"01.12.10 15:10":8.5358400344849,"01.12.10 15:15":10.279600143433,"01.12.10 15:20":11.532199859619,"01.12.10 15:25":11.913599967957,"01.12.10 15:30":11.874799728394,"01.12.10 15:35":11.317500114441,"01.12.10 15:40":10.16609954834,"01.12.10 15:45":9.3069400787354,"01.12.10 15:50":7.8753600120544,"01.12.10 15:55":6.6530900001526,"01.12.10 16:00":6.3746500015259,"01.12.10 16:05":5.0198998451233,"01.12.10 16:10":4.5504999160767,"01.12.10 16:15":3.6865799427032,"01.12.10 16:20":3.2943298816681,"01.12.10 16:25":2.5917000770569,"01.12.10 16:30":1.9024200439453,"01.12.10 16:35":1.4682600498199,"01.12.10 16:40":1.2727099657059,"01.12.10 16:45":1.0283600091934,"01.12.10 16:50":0.39849498867989,"01.12.10 16:55":0.25461700558662,"01.12.10 17:00":-0.021126100793481,"01.12.10 17:05":-0.22742499411106,"01.12.10 17:10":-0.081293098628521,"01.12.10 17:15":-0.30021199584007,"01.12.10 17:20":-0.29970300197601,"01.12.10 17:25":-0.36829799413681,"01.12.10 17:30":-0.38703200221062,"01.12.10 17:35":-0.85442399978638,"01.12.10 17:40":-1.176059961319,"01.12.10 17:45":-1.3766100406647,"01.12.10 17:50":-1.599760055542,"01.12.10 17:55":-1.8692200183868,"01.12.10 18:00":-1.9248000383377,"01.12.10 18:05":-2.139349937439,"01.12.10 18:10":-2.391489982605,"01.12.10 18:15":-2.4363698959351,"01.12.10 18:20":-2.6280601024628,"01.12.10 18:25":-2.8784899711609,"01.12.10 18:30":-2.9104499816895,"01.12.10 18:35":-3.093169927597,"01.12.10 18:40":-3.1578500270844,"01.12.10 18:45":-3.2234799861908,"01.12.10 18:50":-3.3044700622559,"01.12.10 18:55":-3.3486399650574,"01.12.10 19:00":-3.5412399768829,"01.12.10 19:05":-3.7488698959351,"01.12.10 19:10":-3.9066400527954,"01.12.10 19:15":-4.0572600364685,"01.12.10 19:20":-4.1762800216675,"01.12.10 19:25":-4.3302898406982,"01.12.10 19:30":-4.4586701393127,"01.12.10 19:35":-4.5150499343872,"01.12.10 19:40":-4.5969200134277,"01.12.10 19:45":-4.6544098854065,"01.12.10 19:50":-4.7041201591492,"01.12.10 19:55":-4.7585201263428,"01.12.10 20:00":-4.7984299659729,"01.12.10 20:05":-4.7908000946045,"01.12.10 20:10":-4.8102197647095,"01.12.10 20:15":-4.8232398033142,"01.12.10 20:20":-4.8479099273682,"01.12.10 20:25":-4.8401198387146,"01.12.10 20:30":-4.8494400978088,"01.12.10 20:35":-4.8519802093506,"01.12.10 20:40":-4.849730014801,"01.12.10 20:45":-4.8729400634766,"01.12.10 20:50":-4.8964200019836,"01.12.10 20:55":-4.8646302223206,"01.12.10 21:00":-4.8709402084351,"01.12.10 21:05":-4.8278498649597,"01.12.10 21:10":-4.7567901611328,"01.12.10 21:15":-4.7772798538208,"01.12.10 21:20":-4.75443983078,"01.12.10 21:25":-4.7514600753784,"01.12.10 21:30":-4.7682199478149,"01.12.10 21:35":-4.780179977417,"01.12.10 21:40":-4.8023600578308,"01.12.10 21:45":-4.7966499328613,"01.12.10 21:50":-4.7553701400757,"01.12.10 21:55":-4.7612099647522,"01.12.10 22:00":-4.7649102210999,"01.12.10 22:05":-4.7597498893738,"01.12.10 22:10":-4.7195901870728,"01.12.10 22:15":-4.6881499290466,"01.12.10 22:20":-4.5442199707031,"01.12.10 22:25":-4.2881298065186,"01.12.10 22:30":-4.2495398521423,"01.12.10 22:35":-4.1922101974487,"01.12.10 22:40":-4.1591601371765,"01.12.10 22:45":-4.16273021698,"01.12.10 22:50":-4.1199197769165,"01.12.10 22:55":-4.1332302093506,"01.12.10 23:00":-4.1146101951599,"01.12.10 23:05":-4.1284499168396,"01.12.10 23:10":-4.1219401359558,"01.12.10 23:15":-4.1010298728943,"01.12.10 23:20":-4.0825200080872,"01.12.10 23:25":-4.0293998718262,"01.12.10 23:30":-4.070680141449,"01.12.10 23:35":-4.1026802062988,"01.12.10 23:40":-4.10294008255,"01.12.10 23:45":-4.1734299659729,"01.12.10 23:50":-4.1951298713684,"01.12.10 23:55":-4.2187099456787,"02.12.10 00:00":-4.2072501182556,"02.12.10 00:05":-4.1740198135376,"02.12.10 00:10":-4.1761999130249,"02.12.10 00:15":-4.1518201828003,"02.12.10 00:20":-4.19842004776,"02.12.10 00:25":-4.1200799942017,"02.12.10 00:30":-4.1058502197266,"02.12.10 00:35":-4.0729699134827,"02.12.10 00:40":-2.3120300769806,"02.12.10 00:45":0.96246099472046,"02.12.10 00:50":1.0854099988937,"02.12.10 00:55":0.99681198596954,"02.12.10 01:00":0.95223999023438,"02.12.10 01:05":-0.29589501023293,"02.12.10 01:10":-0.94409400224686,"02.12.10 01:15":-1.2827899456024,"02.12.10 01:20":-1.3881599903107,"02.12.10 01:25":-1.4310599565506,"02.12.10 01:30":-1.4729100465775,"02.12.10 01:35":-1.5212500095367,"02.12.10 01:40":-1.2514499425888,"02.12.10 01:45":-0.81017899513245,"02.12.10 01:50":-0.59701597690582,"02.12.10 01:55":-0.21777099370956,"02.12.10 02:00":-0.11118999868631,"02.12.10 02:05":-0.33327201008797,"02.12.10 02:10":-0.34382700920105,"02.12.10 02:15":-0.33442398905754,"02.12.10 02:20":-0.35136198997498,"02.12.10 02:25":-0.35723200440407,"02.12.10 02:30":-0.37591800093651,"02.12.10 02:35":-0.36525499820709,"02.12.10 02:40":-0.39016801118851,"02.12.10 02:45":-0.4079509973526,"02.12.10 02:50":-0.45297199487686,"02.12.10 02:55":-0.47038099169731,"02.12.10 03:00":-0.466726988554,"02.12.10 03:05":-0.47190800309181,"02.12.10 03:10":-0.42447999119759,"02.12.10 03:15":-0.42527601122856,"02.12.10 03:20":-0.41547000408173,"02.12.10 03:25":-0.41130900382996,"02.12.10 03:30":-0.43845000863075,"02.12.10 03:35":-0.40937501192093,"02.12.10 03:40":-0.40286299586296,"02.12.10 03:45":-0.3960539996624,"02.12.10 03:50":-0.4422299861908,"02.12.10 03:55":-0.45473301410675,"02.12.10 04:00":-0.44047400355339,"02.12.10 04:05":-0.44272500276566,"02.12.10 04:10":-0.43100199103355,"02.12.10 04:15":-0.42672300338745,"02.12.10 04:20":-0.42580598592758,"02.12.10 04:25":-0.39883500337601,"02.12.10 04:30":-0.41114699840546,"02.12.10 04:35":-0.38783401250839,"02.12.10 04:40":-0.38521900773048,"02.12.10 04:45":-0.37932398915291,"02.12.10 04:50":-0.36593601107597,"02.12.10 04:55":-0.37370800971985,"02.12.10 05:00":-0.3607439994812,"02.12.10 05:05":-0.37981799244881,"02.12.10 05:10":-0.36495000123978,"02.12.10 05:15":-0.3659560084343,"02.12.10 05:20":-0.36937201023102,"02.12.10 05:25":-0.35289299488068,"02.12.10 05:30":-0.34700000286102,"02.12.10 05:35":-0.34254598617554,"02.12.10 05:40":-0.3132010102272,"02.12.10 05:45":-0.33298900723457,"02.12.10 05:50":-0.3349150121212,"02.12.10 05:55":-0.33985498547554,"02.12.10 06:00":-0.363155990839,"02.12.10 06:05":-0.42892301082611,"02.12.10 06:10":-0.6638879776001,"02.12.10 06:15":-1.1830300092697,"02.12.10 06:20":-1.1743799448013,"02.12.10 06:25":-1.1620899438858,"02.12.10 06:30":-1.2022299766541,"02.12.10 06:35":-1.1894999742508,"02.12.10 06:40":-1.2288199663162,"02.12.10 06:45":-1.2156800031662,"02.12.10 06:50":-1.2149300575256,"02.12.10 06:55":-1.2070399522781,"02.12.10 07:00":-1.1828600168228,"02.12.10 07:05":-1.1414699554443,"02.12.10 07:10":-1.1304199695587,"02.12.10 07:15":-1.1458200216293,"02.12.10 07:20":-1.1758999824524,"02.12.10 07:25":-1.173290014267,"02.12.10 07:30":-1.1714700460434,"02.12.10 07:35":-1.4180699586868,"02.12.10 07:40":-1.390900015831,"02.12.10 07:45":-1.0195800065994,"02.12.10 07:50":-0.90488499403,"02.12.10 07:55":-0.89019799232483,"02.12.10 08:00":-0.92740702629089,"02.12.10 08:05":-0.94692301750183,"02.12.10 08:10":-0.9798229932785,"02.12.10 08:15":-1.2088500261307,"02.12.10 08:20":-1.3102600574493,"02.12.10 08:25":-1.2862000465393,"02.12.10 08:30":-1.252249956131,"02.12.10 08:35":-1.2403199672699,"02.12.10 08:40":-1.2330199480057,"02.12.10 08:45":-1.2635799646378,"02.12.10 08:50":-1.2989900112152,"02.12.10 08:55":-1.2876399755478,"02.12.10 09:00":-1.6799600124359,"02.12.10 09:05":-1.9600600004196,"02.12.10 09:10":-2.0014200210571,"02.12.10 09:15":-1.9969600439072,"02.12.10 09:20":-2.1060900688171,"02.12.10 09:25":-2.2790400981903,"02.12.10 09:30":-2.2961399555206,"02.12.10 09:35":-2.3260700702667,"02.12.10 09:40":-2.3382499217987,"02.12.10 09:45":-2.3367500305176,"02.12.10 09:50":-2.3225200176239,"02.12.10 09:55":-2.3363099098206,"02.12.10 10:00":-2.3027300834656,"02.12.10 10:05":-2.2929599285126,"02.12.10 10:10":-2.2710800170898,"02.12.10 10:15":-2.212110042572,"02.12.10 10:20":-2.1898999214172,"02.12.10 10:25":-2.217129945755,"02.12.10 10:30":-2.1989300251007,"02.12.10 10:35":-2.153589963913,"02.12.10 10:40":-2.1290299892426,"02.12.10 10:45":-2.0749800205231,"02.12.10 10:50":-2.0278499126434,"02.12.10 10:55":-1.9766000509262,"02.12.10 11:00":-1.970929980278,"02.12.10 11:05":-1.9946000576019,"02.12.10 11:10":-1.9456700086594,"02.12.10 11:15":-1.8632099628448,"02.12.10 11:20":-1.8001400232315,"02.12.10 11:25":-1.7732000350952,"02.12.10 11:30":-1.7216299772263,"02.12.10 11:35":-1.699079990387,"02.12.10 11:40":-1.6148600578308,"02.12.10 11:45":-1.5155700445175,"02.12.10 11:50":-1.42757999897,"02.12.10 11:55":-1.3038200139999,"02.12.10 12:00":-1.1836700439453,"02.12.10 12:05":-1.0614000558853,"02.12.10 12:10":-0.88604497909546,"02.12.10 12:15":-0.79673802852631,"02.12.10 12:20":-0.69266998767853,"02.12.10 12:25":-0.62105000019073,"02.12.10 12:30":-0.60336500406265,"02.12.10 12:35":-0.62511301040649,"02.12.10 12:40":-0.5085089802742,"02.12.10 12:45":-0.3846530020237,"02.12.10 12:50":-0.20323400199413,"02.12.10 12:55":0.029036400839686,"02.12.10 13:00":0.18632200360298,"02.12.10 13:05":0.31068998575211,"02.12.10 13:10":0.46976301074028,"02.12.10 13:15":0.68747299909592,"02.12.10 13:20":0.86281698942184,"02.12.10 13:25":0.9976059794426,"02.12.10 13:30":1.1496399641037,"02.12.10 13:35":1.3671699762344,"02.12.10 13:40":1.5390499830246,"02.12.10 13:45":1.5971299409866,"02.12.10 13:50":1.7557499408722,"02.12.10 13:55":1.9028799533844,"02.12.10 14:00":1.9460999965668,"02.12.10 14:05":2.1059598922729,"02.12.10 14:10":2.2425000667572,"02.12.10 14:15":2.2277100086212,"02.12.10 14:20":2.4455499649048,"02.12.10 14:25":2.7643399238586,"02.12.10 14:30":2.8172600269318,"02.12.10 14:35":2.9336500167847,"02.12.10 14:40":3.1703898906708,"02.12.10 14:45":3.4071099758148,"02.12.10 14:50":3.5042400360107,"02.12.10 14:55":3.5605599880219,"02.12.10 15:00":3.554790019989,"02.12.10 15:05":3.8395900726318,"02.12.10 15:10":4.0895900726318,"02.12.10 15:15":4.2630500793457,"02.12.10 15:20":4.1129899024963,"02.12.10 15:25":4.1236801147461,"02.12.10 15:30":3.9825301170349,"02.12.10 15:35":4.0214099884033,"02.12.10 15:40":4.1495499610901,"02.12.10 15:45":4.044310092926,"02.12.10 15:50":3.9696800708771,"02.12.10 15:55":3.8055698871613,"02.12.10 16:00":3.773649930954,"02.12.10 16:05":3.932590007782,"02.12.10 16:10":3.6822800636292,"02.12.10 16:15":3.6784400939941,"02.12.10 16:20":3.783970117569,"02.12.10 16:25":3.791179895401,"02.12.10 16:30":3.8013100624084,"02.12.10 16:35":3.9621798992157,"02.12.10 16:40":4.0480198860168,"02.12.10 16:45":4.1134700775146,"02.12.10 16:50":4.0453901290894,"02.12.10 16:55":3.9114599227905,"02.12.10 17:00":3.726490020752,"02.12.10 17:05":3.6728000640869,"02.12.10 17:10":3.5998499393463,"02.12.10 17:15":3.5566298961639,"02.12.10 17:20":3.4638500213623,"02.12.10 17:25":3.4691700935364,"02.12.10 17:30":3.281219959259,"02.12.10 17:35":2.9569499492645,"02.12.10 17:40":2.8320200443268,"02.12.10 17:45":2.601569890976,"02.12.10 17:50":2.2340099811554,"02.12.10 17:55":2.1971700191498,"02.12.10 18:00":1.9725400209427,"02.12.10 18:05":1.8563499450684,"02.12.10 18:10":1.8073799610138,"02.12.10 18:15":1.7020299434662,"02.12.10 18:20":1.6416599750519,"02.12.10 18:25":1.5386799573898,"02.12.10 18:30":1.3106399774551,"02.12.10 18:35":1.1949299573898,"02.12.10 18:40":1.0599100589752,"02.12.10 18:45":0.84708899259567,"02.12.10 18:50":0.59371000528336,"02.12.10 18:55":0.34930598735809,"02.12.10 19:00":0.20351399481297,"02.12.10 19:05":0.10474000126123,"02.12.10 19:10":-0.0043622800149024,"02.12.10 19:15":-0.12944500148296,"02.12.10 19:20":-0.25034099817276,"02.12.10 19:25":-0.33658000826836,"02.12.10 19:30":-0.42930001020432,"02.12.10 19:35":-0.90231400728226,"02.12.10 19:40":-1.3986200094223,"02.12.10 19:45":-1.5168999433517,"02.12.10 19:50":-1.6059800386429,"02.12.10 19:55":-1.752110004425,"02.12.10 20:00":-1.8756099939346,"02.12.10 20:05":-1.9556900262833,"02.12.10 20:10":-1.9959100484848,"02.12.10 20:15":-2.0558199882507,"02.12.10 20:20":-2.1839001178741,"02.12.10 20:25":-2.3464798927307,"02.12.10 20:30":-2.4262800216675,"02.12.10 20:35":-2.5404999256134,"02.12.10 20:40":-2.6981999874115,"02.12.10 20:45":-2.8063900470734,"02.12.10 20:50":-2.9316298961639,"02.12.10 20:55":-3.0210700035095,"02.12.10 21:00":-3.0817499160767,"02.12.10 21:05":-3.1175000667572,"02.12.10 21:10":-3.1593399047852,"02.12.10 21:15":-3.1923899650574,"02.12.10 21:20":-3.1971800327301,"02.12.10 21:25":-3.2260899543762,"02.12.10 21:30":-3.2968900203705,"02.12.10 21:35":-3.344710111618,"02.12.10 21:40":-3.3198699951172,"02.12.10 21:45":-3.2767798900604,"02.12.10 21:50":-3.2650198936462,"02.12.10 21:55":-3.2815999984741,"02.12.10 22:00":-3.3444499969482,"02.12.10 22:05":-3.3487501144409,"02.12.10 22:10":-3.3359100818634,"02.12.10 22:15":-3.3023700714111,"02.12.10 22:20":-3.3328399658203,"02.12.10 22:25":-3.3232400417328,"02.12.10 22:30":-3.2963700294495,"02.12.10 22:35":-3.2496800422668,"02.12.10 22:40":-3.1935000419617,"02.12.10 22:45":-3.1117498874664,"02.12.10 22:50":-3.0288701057434,"02.12.10 22:55":-2.9776699542999,"02.12.10 23:00":-2.9702498912811,"02.12.10 23:05":-2.9997498989105,"02.12.10 23:10":-3.0110599994659,"02.12.10 23:15":-3.0199298858643,"02.12.10 23:20":-3.0311300754547,"02.12.10 23:25":-3.0368099212646,"02.12.10 23:30":-3.0516800880432,"02.12.10 23:35":-4.2562599182129,"02.12.10 23:40":-5.1512298583984,"02.12.10 23:45":-5.1525797843933}

以下是重新格式化数据的脚本:

 success:function(result){
                    console.log(result);
                    result = $.parseJSON(result);
                    var startDate, endDate, count=0;
                    var dataLength = Object.keys(result).length;;

                    var data = _.map(result, function(value, date){

                        var unformattedDate = new Date(date);                       
                        var year = unformattedDate.getFullYear(),
                            month = unformattedDate.getDate(),
                            day = unformattedDate.getDay(),
                            hour = unformattedDate.getHours(),
                            minute = unformattedDate.getMinutes();

                        var formattedDate = Date.UTC(year,month,day,hour,minute,0);                     

                        if(count  === 0) startDate= formattedDate;                      
                        if(count == dataLength - 1) endDate = formattedDate;

                        count++;

                        return [formattedDate, value];;
                    }); 

                    self.renderBarChart(data, startDate, endDate);
                },
                error: function(req, status, error){
                    console.log(error);
                }

我的渲染图表功能如下所示:

$('#container').highcharts('StockChart',{
                exporting: {
                    enabled: false
                },
                chart: {
                    type: 'spline',
                },
                title: {
                    text: 'Debt Obligations'
                },
                xAxis: {
                    type: 'datetime',
                    title: {
                        text: 'Date'
                    }
                },
                rangeSelector: {
                    selected: false
                },
                yAxis: {
                    title: {
                        text: 'Debt'
                    },
                    min: 0
                },
                tooltip: {
                    headerFormat: '<b>{series.name}</b><br>',
                    pointFormat: '{point.x:%b %e %Y %H:%M:%S}: {point.y}'
                },
                series: [{
                    name: 'Debt Obligation',
                    pointInterval: 4 * 3600 * 1000,
                    pointStart: startDate,
                    data:data
                }]
            });

输出图也按照我想要的方式呈现。但问题在于工具提示和标签上显示的日期以及顶部的日期选择器。

enter image description here

即使我没有2010年的数据,即使我使用formatter(),它也始终显示在2010年1月。

我希望我的标签能够像旧图一样显示出来。 enter image description here

对我做错事的任何帮助都会受到高度赞赏。

0 个答案:

没有答案