时间序列不起作用

时间:2018-03-21 10:06:06

标签: zingchart

我试图设置一个Zingchart时间轴系列,但它没有正常工作。该行不正确,日期没有转换,y轴也显示错误的条目。

有没有人可以看到我做错了什么?

非常感谢

<script>
jQuery(document).ready(function($) {

        zingchart.render({
            "id":"myChart2",
            "adjustLayout": "true",

            "scale-x":{
                "transform":{
                    "type":"date",
                    "all":"%d.%m.%Y",
                    "item":{
                        "visible":"false"
                    }
                },
    "auto-fit":"true"
            },

            "data":{
                "type":"line",
                "title":{
                    "text":"Series Data Objects"
                },
                "series": [
                    {
                        "line-color":"#ff0000",
            "values": [["825552000000","248.22"],["828057600000","248.08"],["830822400000","256.50"],["833500800000","255.54"],["835920000000","259.12"],["838771200000","238.70"],["841449600000","240.49"],["844041600000","241.09"],["846633600000","241.36"],["849312000000","253.61"],["851990400000","259.85"],["854668800000","293.11"],["857088000000","297.88"],["859420800000","308.32"],["862358400000","319.51"],["864950400000","332.99"],["867628800000","359.04"],["870307200000","367.30"],["872812800000","358.41"],["875577600000","362.73"],["878256000000","335.60"],["880675200000","338.64"],["883526400000","333.78"],["886118400000","347.69"],["888624000000","374.74"],["891302400000","414.51"],["893894400000","425.38"],["896400000000","455.20"],["899164800000","449.35"],["901843200000","444.80"],["904521600000","373.21"],["907113600000","331.78"],["909792000000","350.40"],["912384000000","361.39"],["915062400000","352.06"],["917568000000","339.32"],["919987200000","351.13"],["922838400000","373.90"],["925430400000","400.78"],["928108800000","403.39"],["930700800000","411.89"],["933292800000","412.81"],["936057600000","423.43"],["938649600000","432.41"],["941328000000","434.90"],["943920000000","460.06"],["946512000000","488.37"],["949276800000","526.76"],["951782400000","546.37"],["954460800000","552.29"],["957052800000","550.44"],["959731200000","557.94"],["962323200000","565.27"],["965001600000","580.34"],["967680000000","592.46"],["970185600000","593.84"],["972950400000","586.73"],["975542400000","587.99"],["978220800000","574.41"],["980899200000","591.06"],["983318400000","584.99"],["985910400000","556.95"],["988588800000","564.08"],["991267200000","573.05"],["993772800000","562.91"],["996537600000","524.32"],["999216000000","497.57"],["1001635200000","397.34"],["1004486400000","411.61"],["1007078400000","428.81"],["1009756800000","442.50"],["1012435200000","429.54"],["1014854400000","421.18"],["1017532800000","450.53"],["1020124800000","472.24"],["1022803200000","498.40"],["1025222400000","468.36"],["1028073600000","429.21"],["1030752000000","421.15"],["1033344000000","377.54"],["1036022400000","358.54"],["1038528000000","377.31"],["1041292800000","367.59"],["1043971200000","345.28"],["1046390400000","333.31"],["1049068800000","339.64"],["1051660800000","380.18"],["1054252800000","393.14"],["1056931200000","400.88"],["1059609600000","413.35"],["1062115200000","442.21"],["1064880000000","452.48"],["1067558400000","477.75"],["1069977600000","481.48"],["1072742400000","489.31"],["1075420800000","526.61"],["1078012800000","540.60"],["1080691200000","535.48"],["1083283200000","562.73"],["1085702400000","566.69"],["1088553600000","595.42"],["1091145600000","582.42"],["1093910400000","575.98"],["1096502400000","584.63"],["1099008000000","574.38"],["1101772800000","582.98"],["1104451200000","603.91"],["1107129600000","635.69"],["1109548800000","666.30"],["1112227200000","676.75"],["1114732800000","659.07"],["1117497600000","673.11"],["1120089600000","694.10"],["1122595200000","740.74"],["1125446400000","756.92"],["1128038400000","780.60"],["1130716800000","756.80"],["1133308800000","752.26"],["1135900800000","769.52"],["1138665600000","820.12"],["1141084800000","865.22"],["1143763200000","889.63"],["1146182400000","936.09"],["1149033600000","894.71"],["1151625600000","877.78"],["1154304000000","895.81"],["1156982400000","925.75"],["1159488000000","949.28"],["1162252800000","992.61"],["1164844800000","1021.22"],["1167350400000","1089.17"],["1170201600000","1164.23"],["1172620800000","1156.02"],["1175212800000","1195.74"],["1177891200000","1293.23"],["1180569600000","1339.80"],["1183075200000","1349.97"],["1185840000000","1359.15"],["1188518400000","1330.35"],["1190937600000","1336.06"],["1193788800000","1402.84"],["1196380800000","1187.53"],["1198800000000","1302.28"],["1201737600000","1125.40"],["1204243200000","1140.95"],["1206921600000","1094.89"],["1209513600000","1142.30"],["1212105600000","1145.74"],["1214784000000","1095.27"],["1217462400000","1033.11"],["1219968000000","1055.30"],["1222732800000","931.33"],["1225411200000","708.98"],["1227744000000","621.59"],["1230595200000","616.87"],["1233273600000","603.03"],["1235692800000","552.63"],["1238457600000","539.30"],["1241049600000","638.71"],["1243555200000","684.26"],["1246320000000","695.27"],["1248998400000","742.61"],["1251676800000","791.45"],["1254268800000","813.03"],["1256860800000","796.28"],["1259539200000","773.35"],["1262131200000","802.69"],["1264723200000","839.72"],["1267142400000","823.41"],["1269993600000","893.27"],["1272585600000","918.51"],["1275264000000","887.80"],["1277856000000","877.87"],["1280448000000","905.59"],["1283212800000","917.29"],["1285804800000","950.25"],["1288310400000","997.97"],["1291075200000","1010.56"],["1293667200000","1091.59"],["1296432000000","1108.11"],["1298851200000","1125.12"],["1301529600000","1139.23"],["1304035200000","1172.38"],["1306800000000","1159.70"],["1309392000000","1079.62"],["1311897600000","992.65"],["1314748800000","910.04"],["1317340800000","842.27"],["1320019200000","865.83"],["1322611200000","835.59"],["1325203200000","827.32"],["1327968000000","889.40"],["1330473600000","939.11"],["1333065600000","947.00"],["1335744000000","952.62"],["1338422400000","890.97"],["1340928000000","892.26"],["1343692800000","900.41"],["1346371200000","892.48"],["1348790400000","918.34"],["1351641600000","917.96"],["1354233600000","908.92"],["1356652800000","934.70"],["1359590400000","992.75"],["1362009600000","1018.12"],["1364428800000","1029.32"],["1367280000000","1034.59"],["1369958400000","1048.29"],["1372377600000","1036.88"],["1375228800000","1063.80"],["1377820800000","1109.08"],["1380499200000","1140.76"],["1383177600000","1180.44"],["1385683200000","1203.78"],["1388361600000","1227.91"],["1391040000000","1266.04"],["1393545600000","1277.03"],["1396224000000","1316.99"],["1398816000000","1335.68"],["1401408000000","1326.99"],["1404086400000","1335.88"],["1406764800000","1316.64"],["1409270400000","1307.37"],["1412035200000","1264.57"],["1414713600000","1260.85"],["1417132800000","1286.13"],["1419897600000","1270.55"],["1422576000000","1149.42"],["1424995200000","1263.92"],["1427760000000","1321.38"],["1430352000000","1344.94"],["1432857600000","1355.69"],["1435622400000","1305.78"],["1438300800000","1330.99"],["1440979200000","1317.52"],["1443571200000","1296.63"],["1446163200000","1337.35"],["1448841600000","1397.59"],["1451433600000","1423.16"],["1454025600000","1358.41"],["1456704000000","1397.02"],["1459382400000","1477.83"],["1461888000000","1510.31"],["1464652800000","1584.98"],["1467244800000","1541.25"],["1469750400000","1633.75"],["1472601600000","1755.57"],["1475193600000","1781.34"],["1477872000000","1763.37"],["1480377600000","1730.74"],["1483056000000","1799.97"],["1485820800000","1888.34"],["1488240000000","2006.37"],["1490918400000","2073.79"],["1493337600000","2197.66"],["1496188800000","2250.52"],["1498780800000","2256.34"],["1501459200000","2294.53"],["1504137600000","2264.10"],["1506643200000","2350.68"],["1509062400000","2407.96"],["1512000000000","2473.35"],["1514505600000","2539.02"],["1517356800000","2590.74"],["1519776000000","2530.56"],["1521417600000","2502.57"]]
        },
                ]
            }
        });     

});         

</script>       

<div id="myChart2" class="chart"></div>

JSFiddle

1 个答案:

答案 0 :(得分:0)

图表行未正确显示的原因是您格式化值的方式。你的值是这样的引号:[“825552000000”,“248.22”]。

值的格式化方式是WITHOUT引号。值的格式应如下:[825552000000,248.22]。

删除所有值上的引号后,图表行将正确显示。

希望这有帮助。