2017-02-22 21 views
0

Я работаю с highchart и пытаюсь построить данные временных рядов для данных запаса. он отлично работает для других данных, но ниже данных он не может нарисовать диаграмму. Я не понимаю, почему:что не так в этой серии данных, что высокая диаграмма не замышляет это?

[ 
[1441756800000, 73.99], 
[1441843200000, 74.04], 
[1441929600000, 73.98], 
[1442188800000, 73.94], 
[1442275200000, 73.76], 
[1442361600000, 73.43], 
[1442448000000, 73.12], 
[1442534400000, 72.81], 
[1442793600000, 72.67], 
[1442880000000, 72.72], 
[1442966400000, 72.84], 
[1443052800000, 73.02], 
[1443139200000, 73.29], 
[1443398400000, 73.53], 
[1443484800000, 73.95], 
[1443571200000, 74.32], 
[1443657600000, 74.54], 
[1443744000000, 74.85], 
[1444003200000, 75.15], 
[1444089600000, 75.15], 
[1444176000000, 75.18], 
[1444262400000, 75.11], 
[1444348800000, 74.66], 
[1444608000000, 74.39], 
[1444694400000, 74.08], 
[1444780800000, 73.83], 
[1444867200000, 73.66], 
[1444953600000, 73.42], 
[1445212800000, 73.03], 
[1445299200000, 72.73], 
[1445385600000, 72.45], 
[1445472000000, 72.21], 
[1445558400000, 72.35], 
[1445817600000, 72.32], 
[1445904000000, 72.25], 
[1445990400000, 72.18], 
[1446076800000, 72.03], 
[1446163200000, 71.81], 
[1446422400000, 71.61], 
[1446508800000, 71.39], 
[1446595200000, 71.1], 
[1446681600000, 70.92], 
[1446768000000, 70.8], 
[1447027200000, 70.62], 
[1447113600000, 70.5], 
[1447200000000, 70.33], 
[1447286400000, 70.21], 
[1447372800000, 70.2], 
[1447632000000, 70.24], 
[1447718400000, 70.3], 
[1447804800000, 70.3], 
[1447891200000, 70.14], 
[1447977600000, 69.98], 
[1448236800000, 69.8], 
[1448323200000, 69.57], 
[1448409600000, 69.4], 
[1448582400000, 69.24], 
[1448841600000, 68.95], 
[1448928000000, 68.68], 
[1449014400000, 68.48], 
[1449100800000, 68.43], 
[1449187200000, 68.35], 
[1449446400000, 68.03], 
[1449532800000, 67.81], 
[1449619200000, 67.71], 
[1449705600000, 67.72], 
[1449792000000, 67.73], 
[1450051200000, 67.81], 
[1450137600000, 67.98], 
[1450224000000, 67.98], 
[1450310400000, 67.87], 
[1450396800000, 67.68], 
[1450656000000, 67.55], 
[1450742400000, 67.19], 
[1450828800000, 66.72], 
[1450915200000, 66.13], 
[1451260800000, 65.56], 
[1451347200000, 65.07], 
[1451433600000, 64.34], 
[1451520000000, 63.7], 
[1451865600000, 63.08], 
[1451952000000, 62.62], 
[1452038400000, 62.3], 
[1452124800000, 62.13], 
[1452211200000, 61.27], 
[1452470400000, 60.42], 
[1452556800000, 59.54], 
[1452643200000, 58.57], 
[1452729600000, 57.6], 
[1452816000000, 56.64], 
[1453161600000, 55.83], 
[1453248000000, 54.95], 
[1453334400000, 54.07], 
[1453420800000, 53.26], 
[1453680000000, 53.16], 
[1453766400000, 52.9], 
[1453852800000, 52.66], 
[1453939200000, 52.44], 
[1454025600000, 52.27], 
[1454284800000, 52.18], 
[1454371200000, 52.04], 
[1454457600000, 52.03], 
[1454544000000, 52.03], 
[1454630400000, 52.07], 
[1454889600000, 52.23], 
[1454976000000, 52.49], 
[1455062400000, 52.69], 
[1455148800000, 53], 
[1455235200000, 53.41], 
[1455580800000, 53.7], 
[1455667200000, 54.06], 
[1455753600000, 54.4], 
[1455840000000, 54.79], 
[1456099200000, 55.14], 
[1456185600000, 55.47], 
[1456272000000, 55.89], 
[1456358400000, 56.33], 
[1456444800000, 56.65], 
[1456704000000, 57.06], 
[1456790400000, 57.45], 
[1456876800000, 57.69], 
[1456963200000, 57.94], 
[1457049600000, 58.13], 
[1457308800000, 58.42], 
[1457395200000, 58.64], 
[1457481600000, 58.75], 
[1457568000000, 58.91], 
[1457654400000, 59.08], 
[1457913600000, 59.16], 
[1458000000000, 59.26], 
[1458086400000, 59.36], 
[1458172800000, 59.53], 
[1458259200000, 59.63], 
[1458518400000, 59.57], 
[1458604800000, 59.47], 
[1458691200000, 59.43], 
[1458777600000, 59.28], 
[1459123200000, 59.21], 
[1459209600000, 59.2], 
[1459296000000, 59.23], 
[1459382400000, 59.45], 
[1459468800000, 59.58], 
[1459728000000, 59.72], 
[1459814400000, 59.94], 
[1459900800000, 60.3], 
[1459987200000, 60.81], 
[1460073600000, 61.47], 
[1460332800000, 62.11], 
[1460419200000, 62.69], 
[1460505600000, 63.23], 
[1460592000000, 63.63], 
[1460678400000, 63.96], 
[1460937600000, 64.29], 
[1461024000000, 64.59], 
[1461110400000, 64.72], 
[1461196800000, 64.64], 
[1461283200000, 64.48], 
[1461542400000, 64.34], 
[1461628800000, 64.17], 
[1461715200000, 64.03], 
[1461801600000, 63.87], 
[1461888000000, 63.72], 
[1462147200000, 63.59], 
[1462233600000, 63.43], 
[1462320000000, 63.23], 
[1462406400000, 63.16], 
[1462492800000, 63.04], 
[1462752000000, 62.98], 
[1462838400000, 62.94], 
[1462924800000, 62.95], 
[1463011200000, 63.02], 
[1463097600000, 63.1], 
[1463356800000, 63.24], 
[1463443200000, 63.41], 
[1463529600000, 63.72], 
[1463616000000, 64], 
[1463702400000, 64.28], 
[1463961600000, 64.47], 
[1464048000000, 64.7], 
[1464134400000, 64.84], 
[1464220800000, 64.88], 
[1464307200000, 64.85], 
[1464652800000, 64.67], 
[1464739200000, 64.21], 
[1464825600000, 63.76], 
[1464912000000, 63.32], 
[1465171200000, 62.97], 
[1465257600000, 62.61], 
[1465344000000, 62.25], 
[1465430400000, 61.83], 
[1465516800000, 61.58], 
[1465776000000, 61.1], 
[1465862400000, 60.51], 
[1465948800000, 60.2], 
[1466035200000, 60.05], 
[1466121600000, 59.96], 
[1466380800000, 59.88], 
[1466467200000, 59.6], 
[1466553600000, 59.35], 
[1466640000000, 59.17], 
[1466726400000, 59.03], 
[1466985600000, 59.26], 
[1467072000000, 59.82], 
[1467158400000, 60.36], 
[1467244800000, 60.76], 
[1467331200000, 61.06], 
[1467676800000, 61.38], 
[1467763200000, 61.88], 
[1467849600000, 62.38], 
[1467936000000, 62.74], 
[1468195200000, 63.01], 
[1468281600000, 63.23], 
[1468368000000, 63.36], 
[1468454400000, 63.51], 
[1468540800000, 63.63], 
[1468800000000, 63.69], 
[1468886400000, 63.71], 
[1468972800000, 63.64], 
[1469059200000, 63.58], 
[1469145600000, 63.63], 
[1469404800000, 63.75], 
[1469491200000, 63.9], 
[1469577600000, 64], 
[1469664000000, 64.01], 
[1469750400000, 64.08], 
[1470009600000, 64.17], 
[1470096000000, 64.32], 
[1470182400000, 64.5], 
[1470268800000, 64.69], 
[1470355200000, 64.85], 
[1470614400000, 64.85], 
[1470700800000, 64.81], 
[1470787200000, 64.84], 
[1470873600000, 64.88], 
[1470960000000, 64.83], 
[1471219200000, 64.77], 
[1471305600000, 64.76], 
[1471392000000, 64.78], 
[1471478400000, 64.77], 
[1471564800000, 64.69], 
[1471824000000, 64.66], 
[1471910400000, 64.7], 
[1471996800000, 64.75], 
[1472083200000, 64.85], 
[1472169600000, 64.87], 
[1472428800000, 64.98], 
[1472515200000, 64.86], 
[1472601600000, 64.67], 
[1472688000000, 64.49], 
[1472774400000, 64.37], 
[1473120000000, 64.26], 
[1473206400000, 64.06], 
[1473292800000, 63.87], 
[1473379200000, 63.71], 
[1473638400000, 63.58], 
[1473724800000, 63.34], 
[1473811200000, 63.33], 
[1473897600000, 63.4], 
[1473984000000, 63.36], 
[1474243200000, 63.4], 
[1474329600000, 63.37], 
[1474416000000, 63.39], 
[1474502400000, 63.43], 
[1474588800000, 63.19], 
[1474848000000, 63.02], 
[1474934400000, 62.9], 
[1475020800000, 62.59], 
[1475107200000, 62.27], 
[1475193600000, 62.01], 
[1475452800000, 61.65], 
[1475539200000, 61.29], 
[1475625600000, 60.95], 
[1475712000000, 60.64], 
[1475798400000, 61.12], 
[1476057600000, 61.67], 
[1476144000000, 62.19], 
[1476230400000, 62.78], 
[1476316800000, 63.39], 
[1476403200000, 64.03], 
[1476662400000, 64.66], 
[1476748800000, 65.31], 
[1476835200000, 65.93], 
[1476921600000, 66.34], 
[1477008000000, 66.2], 
[1477267200000, 66.02], 
[1477353600000, 66.01], 
[1477440000000, 66.04], 
[1477526400000, 66.23], 
[1477612800000, 66.55], 
[1477872000000, 66.95], 
[1477958400000, 67.55], 
[1478044800000, 68.17], 
[1478131200000, 68.79], 
[1478217600000, 69.43], 
[1478476800000, 69.98], 
[1478563200000, 70.43], 
[1478649600000, 70.89], 
[1478736000000, 71.31], 
[1478822400000, 71.58], 
[1479081600000, 71.74], 
[1479168000000, 71.65], 
[1479254400000, 71.61], 
[1479340800000, 71.69], 
[1479427200000, 71.7], 
[1479686400000, 71.8], 
[1479772800000, 71.88], 
[1479859200000, 72.13], 
[1480032000000, 72.34], 
[1480291200000, 72.53], 
[1480377600000, 72.67], 
[1480464000000, 72.91], 
[1480550400000, 73.11], 
[1480636800000, 73.35], 
[1480896000000, 73.66], 
[1480982400000, 73.91], 
[1481068800000, 74.18], 
[1481155200000, 74.29], 
[1481241600000, 74.25], 
[1481500800000, 74.27], 
[1481587200000, 74.41], 
[1481673600000, 74.47], 
[1481760000000, 74.45], 
[1481846400000, 74.37], 
[1482105600000, 74.4], 
[1482192000000, 74.6], 
[1482278400000, 74.66], 
[1482364800000, 74.71], 
[1482451200000, 74.87], 
[1482796800000, 75.07], 
[1482883200000, 75.29], 
[1482969600000, 75.58], 
[1483056000000, 75.88], 
[1483401600000, 76.16], 
[1483488000000, 76.41], 
[1483574400000, 76.45], 
[1483660800000, 76.54], 
[1483920000000, 76.59], 
[1484006400000, 76.74], 
[1484092800000, 76.77], 
[1484179200000, 76.77], 
[1484265600000, 76.77], 
[1484611200000, 76.83], 
[1484697600000, 76.81], 
[1484784000000, 76.74], 
[1484870400000, 76.72], 
[1485129600000, 76.9], 
[1485216000000, 77.09], 
[1485302400000, 77.12], 
[1485388800000, 77.21], 
[1485475200000, 77.33], 
[1485734400000, 77.5], 
[1485820800000, 77.66], 
[1485907200000, 77.96], 
[1485993600000, 78.25], 
[1486080000000, 78.55], 
[1486339200000, 78.71] 
] 

мой код для высокой графике:

new Highcharts.Chart({ 
     chart: { 
      renderTo: 'container', 
      /*zoomType: 'x'*/ 

     }, 
     /*tooltip: { 
      formatter: function() { 
       return 'Open: <b>' + this.point.open + '</b><br/>' + 
         'Close: <b>' + this.point.close + '</b><br/>' + 
         'High: <b>' + this.point.high + '</b><br/>' + 
         'Low: <b>' + this.point.low + '</b><br/>' + 
         'Volume: <b>' + this.point.volume + '</b><br/>'; 
      } 
     },*/ 
     title: { 
      text: 'Stock Exchange Trading Data' 
     }, 
     /*subtitle: { 
      text: document.ontouchstart === undefined ? 
        'Click and drag in the plot area to zoom in' : 'Pinch the chart to zoom in' 
     },*/ 
     xAxis: { 
      type: 'datetime' 
     }, 
     yAxis: { 
      title: { 
       text: 'Trading Close Value' 
      } 
     }, 
     legend: { 
      enabled: false 
     }, 
     plotOptions: { 
      series:{ 
       turboThreshold:5000//set it to a larger threshold, it is by default to 1000 
      }, 
      area: { 
       cropThreshold: 5, 
       fillColor: { 
        linearGradient: { 
         x1: 0, 
         y1: 0, 
         x2: 0, 
         y2: 1 
        }, 
        stops: [ 
         [0, Highcharts.getOptions().colors[0]], 
         [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')] 
        ] 
       }, 
       marker: { 
        radius: 2 
       }, 
       lineWidth: 1, 
       states: { 
        hover: { 
         lineWidth: 1 
        } 
       }, 
       threshold: null 
      }, 
      line: { 
       zIndex: 1, 
       marker: { 
        fillColor: 'red', 
        lineWidth: 1, 
        lineColor: 'red' 
       }, 
      } 

     }, 

     series: [{ 
      type: 'area', 
      name: 'Stock Trading Data', 
      data: data[0] 
     }, { 
      type: 'area', 
      data: data[1] 
     }] 
    }); 
} 

данных [0] и данные [1] оба же говорят данные.

ответ

1

Я удалил последний } с вашего кода, и он отлично работает.

new Highcharts.Chart({ 
     chart: { 
      renderTo: 'container', 
      /*zoomType: 'x'*/ 

     }, 
     /*tooltip: { 
      formatter: function() { 
       return 'Open: <b>' + this.point.open + '</b><br/>' + 
         'Close: <b>' + this.point.close + '</b><br/>' + 
         'High: <b>' + this.point.high + '</b><br/>' + 
         'Low: <b>' + this.point.low + '</b><br/>' + 
         'Volume: <b>' + this.point.volume + '</b><br/>'; 
      } 
     },*/ 
     title: { 
      text: 'Stock Exchange Trading Data' 
     }, 
     /*subtitle: { 
      text: document.ontouchstart === undefined ? 
        'Click and drag in the plot area to zoom in' : 'Pinch the chart to zoom in' 
     },*/ 
     xAxis: { 
      type: 'datetime' 
     }, 
     yAxis: { 
      title: { 
       text: 'Trading Close Value' 
      } 
     }, 
     legend: { 
      enabled: false 
     }, 
     plotOptions: { 
      series:{ 
       turboThreshold:5000//set it to a larger threshold, it is by default to 1000 
      }, 
      area: { 
       cropThreshold: 5, 
       fillColor: { 
        linearGradient: { 
         x1: 0, 
         y1: 0, 
         x2: 0, 
         y2: 1 
        }, 
        stops: [ 
         [0, Highcharts.getOptions().colors[0]], 
         [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')] 
        ] 
       }, 
       marker: { 
        radius: 2 
       }, 
       lineWidth: 1, 
       states: { 
        hover: { 
         lineWidth: 1 
        } 
       }, 
       threshold: null 
      }, 
      line: { 
       zIndex: 1, 
       marker: { 
        fillColor: 'red', 
        lineWidth: 1, 
        lineColor: 'red' 
       }, 
      } 

     }, 

     series: [{ 
      type: 'area', 
      name: 'Stock Trading Data', 
      data: data[0] 
     }, { 
      type: 'area', 
      data: data[1] 
     }] 
    }); 

js fiddle

+0

Пожалуйста, вы можете перейти к: http://139.59.236.7:8000/ и нажмите ADD индикатор и нажмите + в простой скользящей средней и увидеть, что это не так? –

+0

предполагается построить 2 участка одной линии и одной диаграммы области, но я не понимаю, что случилось. –

+0

@RoshanBhandari Есть мини-js, я не могу просмотреть этот код. Вы хотите что-то вроде этого? http://www.highcharts.com/demo/spline-plot-bands –