3

ローソク足チャート (Highstock -> Highcharts) にデータ系列を追加する際に問題があります。

脚本:

$.ajax({
            url : 'indicator',
            type : 'GET',
            data : {
                currency : $("#selectionField3").val(),
                period : $("#selectionField2 option:selected").val(),
                indicator : 'cos'
            },
            success : function(data) {
                console.log('data2');
                console.log(chart);
                console.log(data);
                chart.addSeries([ {
                    type : 'line',
                    name : 'wskaznik',
                    data : data
                } ], true, true);

                chart.redraw();
                console.log(chart);
            },
            error : function(data) {
                console.log(data);
            }

別の方法で試しましたが、それでもうまくいきません。

function setButtonIndicator() {
    $('.checkboxButton').click(function() {
        var name = $(this).attr("name");
        $.ajax({
            url : 'indicator',
            type : 'GET',
            data : {
                currency : $("#selectionField3").val(),
                period : $("#selectionField2 option:selected").val(),
                indicator : 'cos'
            },
            success : function(data) {
                console.log('data2');
                console.log(chart);
                console.log(data);
                chart.addSeries({
                    type : 'line',
                    name : 'wskaznik',
                    data : data
                }, true, true);

                chart.redraw();
                console.log(chart);
            },
            error : function(data) {
                alert(data);
                console.log(data);
            }

        });

        if (indicators[name]) {
            $(this).css({
                'opacity' : '0.5'
            });
        } else {
            $(this).css({
                'opacity' : '1'
            });
        }
        indicators[name] = !indicators[name];

    });
}

データは次のようになります。

[
[1357084080000,1.03909],
[1357084140000,1.0391],
[1357084200000,1.03912],
[1357084260000,1.03913],
[1357084320000,1.03917],
[1357084380000,1.03921],
[1357084440000,1.03925],
[1357084500000,1.0393],
[1357084620000,1.03935],
[1357084680000,1.0394],
[1357084740000,1.03945],
[1357084800000,1.0395],
[1357084860000,1.03955],
[1357084920000,1.03959],
[1357084980000,1.03963],
[1357085040000,1.03966],
[1357085100000,1.03968],
[1357085160000,1.03969],
[1357085220000,1.03969],
[1357085280000,1.03967],
[1357085340000,1.03965],
[1357085400000,1.03963],
[1357085460000,1.03961],
[1357085520000,1.03959],
[1357085580000,1.03959],
[1357085640000,1.03958],
[1357085700000,1.03958],
[1357085760000,1.03957],
[1357085820000,1.03956],
[1357085880000,1.03955],
[1357085940000,1.03954],
[1357086000000,1.03953],
[1357086060000,1.03952],
[1357086120000,1.03952],
[1357086180000,1.03953],
[1357086240000,1.03952],
[1357086300000,1.03952],
[1357086360000,1.03951],
[1357086420000,1.03948],
[1357086480000,1.03946],
[1357086540000,1.03943],
[1357086600000,1.0394],
[1357086660000,1.03936],
[1357086720000,1.03937],
[1357086780000,1.03938],
[1357086840000,1.03941],
[1357086900000,1.03947],
[1357086960000,1.03954],
[1357087020000,1.03966],
[1357087080000,1.03978],
[1357087140000,1.03994],
[1357087200000,1.04008],
[1357087260000,1.04024],
[1357087320000,1.04039],
[1357087380000,1.04053],
[1357087440000,1.04066],
[1357087500000,1.04081],
[1357087560000,1.0409],
[1357087620000,1.04102],
[1357087680000,1.0411],
[1357087740000,1.04116],
[1357087800000,1.04122],
[1357087860000,1.04125],
[1357087920000,1.0413],
[1357087980000,1.04132],
[1357088040000,1.0414],
[1357088100000,1.04148],
[1357088160000,1.04154],
[1357088220000,1.04162],
[1357088280000,1.04171],
[1357088340000,1.04178],
[1357088400000,1.04187],
[1357088460000,1.04194],
[1357088520000,1.04203],
[1357088580000,1.04213],
[1357088640000,1.04222],
[1357088700000,1.0423],
[1357088760000,1.04237],
[1357088820000,1.04242],
[1357088880000,1.04243],
[1357088940000,1.04244],
[1357089000000,1.04247],
[1357089060000,1.0425],
[1357089120000,1.04255],
[1357089180000,1.04262],
[1357089240000,1.04267],
[1357089300000,1.04272],
[1357089360000,1.04275],
[1357089420000,1.04279],
[1357089480000,1.04283],
[1357089540000,1.04285],
[1357089600000,1.04289],
[1357089660000,1.04294],
[1357089720000,1.04299],
[1357089780000,1.04305],
[1357089840000,1.04309],
[1357089900000,1.04313],
[1357089960000,1.04318],
[1357090020000,1.0432],
[1357090080000,1.04324],
[1357090140000,1.04329],
[1357090200000,1.04333],
[1357090260000,1.04337],
[1357090320000,1.04343],
[1357090380000,1.04352],
[1357090440000,1.04363],
[1357090500000,1.0438],
[1357090560000,1.04396],
[1357090620000,1.04411],
[1357090680000,1.04428],
[1357090740000,1.04446],
[1357090800000,1.04461],
[1357090860000,1.04476],
[1357090920000,1.04488],
[1357090980000,1.04499],
[1357091040000,1.0451],
[1357091100000,1.04521],
[1357091160000,1.04531],
[1357091220000,1.04542],
[1357091280000,1.04552],
[1357091340000,1.04553],
[1357091400000,1.04556],
[1357091460000,1.04559],
[1357091520000,1.04562],
[1357091580000,1.04563],
[1357091640000,1.04567],
[1357091700000,1.04574],
[1357091760000,1.04585],
[1357091820000,1.04594],
[1357091880000,1.04604],
[1357091940000,1.04612],
[1357092000000,1.04619],
[1357092060000,1.04621],
[1357092120000,1.04626],
[1357092180000,1.04633],
[1357092240000,1.04641],
[1357092300000,1.04648],
[1357092360000,1.04651],
[1357092420000,1.04653],
[1357092480000,1.04656],
[1357092540000,1.04657],
[1357092600000,1.04658],
[1357092660000,1.0466],
[1357092720000,1.04664],
[1357092780000,1.04669],
[1357092840000,1.04673],
[1357092900000,1.04676],
[1357092960000,1.04678],
[1357093020000,1.0468],
[1357093080000,1.0468],
[1357093140000,1.04682],
[1357093200000,1.04686],
[1357093260000,1.04691],
[1357093320000,1.04697],
[1357093380000,1.04701],
[1357093440000,1.04704],
[1357093500000,1.04708],
[1357093560000,1.04712],
[1357093620000,1.0472],
[1357093680000,1.04736],
[1357093740000,1.04749],
[1357093800000,1.0476],
[1357093860000,1.0477],
[1357093920000,1.0478],
[1357093980000,1.04787],
[1357094040000,1.04798],
[1357094100000,1.0481],
[1357094160000,1.04819],
[1357094220000,1.04829],
[1357094280000,1.04838],
[1357299120000,1.04024],
[1357299180000,1.04025],
[1357299240000,1.04027],
[1357299300000,1.0403],
[1357299360000,1.04032],
[1357299420000,1.04033],
[1357299480000,1.04035],
[1357299540000,1.04038],
[1357299600000,1.04041],
[1357299660000,1.04046],
[1357299720000,1.04047],
[1357299780000,1.04047],
[1357299840000,1.04047],
[1357299900000,1.04047],
[1357299960000,1.04045],
[1357300020000,1.04041],
[1357300080000,1.04039],
[1357300140000,1.04038],
[1357300200000,1.04038],
[1357300260000,1.04038],
[1357300320000,1.04038],
[1357300380000,1.04039],
[1357300440000,1.0404],
[1357300500000,1.04042],
[1357300560000,1.04047],
[1357300620000,1.04051],
[1357300680000,1.04055],
[1357300740000,1.04059],
[1357300800000,1.04064],
[1357300860000,1.04071],
[1357300920000,1.04075],
[1357300980000,1.0408],
[1357301040000,1.04083],
[1357301100000,1.04086],
[1357301160000,1.0409],
[1357301220000,1.04092],
[1357301280000,1.04093],
[1357301340000,1.04094],
[1357301400000,1.04094],
[1357301460000,1.04094],
[1357301520000,1.04094],
[1357301580000,1.04094],
[1357301640000,1.04095],
[1357301700000,1.04095],
[1357301760000,1.04096],
[1357301820000,1.04097],
[1357301880000,1.04097],
[1357301940000,1.04098],
[1357302000000,1.04098],
[1357302060000,1.04097],
[1357302120000,1.04098],
[1357302180000,1.04098],
[1357302240000,1.04096],
[1357302300000,1.04094],
[1357302360000,1.04093],
[1357302420000,1.04093],
[1357302480000,1.04092],
[1357302540000,1.04091],
[1357302600000,1.04089],
[1357302660000,1.04085],
[1357302720000,1.0408],
[1357302780000,1.04076],
[1357302840000,1.04076],
[1357302900000,1.04073],
[1357302960000,1.0407],
[1357303020000,1.04067],
[1357303080000,1.04064],
[1357303140000,1.04062],
[1357303200000,1.04059],
[1357303260000,1.04058],
[1357303320000,1.04055],
[1357303380000,1.04056],
[1357303440000,1.04058],
[1357303500000,1.04062],
[1357303560000,1.04066],
[1357303620000,1.04069],
[1357303680000,1.04069],
[1357303740000,1.04072],
[1357303800000,1.04077],
[1357303860000,1.04082],
[1357303920000,1.04089],
[1357303980000,1.04097],
[1357304040000,1.04105],
[1357304100000,1.04112],
[1357304160000,1.0412],
[1357304220000,1.04125],
[1357304280000,1.04131],
[1357304340000,1.04135],
[1357304400000,1.04138],
[1357304460000,1.04141],
[1357304520000,1.04145],
[1357304580000,1.04147],
[1357304640000,1.04147],
[1357304700000,1.04149],
[1357304760000,1.04148],
[1357304820000,1.04147],
[1357304880000,1.04145],
[1357304940000,1.04144],
[1357305000000,1.04142],
[1357305060000,1.0414],
[1357305180000,1.04138],
[1357305240000,1.04138],
[1357305300000,1.04138],
[1357305360000,1.04139],
[1357305420000,1.0415],
[1357321260000,1.04597],
[1357321320000,1.04601],
[1357321380000,1.04606],
[1357321440000,1.04611],
[1357321500000,1.04615],
[1357321560000,1.04619],
[1357321620000,1.04623],
[1357321680000,1.04626],
[1357321740000,1.04629],
[1357321800000,1.04632],
[1357321860000,1.04635],
[1357321920000,1.04636],
[1357321980000,1.04637],
[1357322040000,1.04638],
[1357322100000,1.04638],
[1357322160000,1.04637],
[1357322220000,1.04636],
[1357322280000,1.04636],
[1357322340000,1.04636],
[1357322400000,1.04637],
[1357322460000,1.04637],
[1357322520000,1.04639],
[1357322580000,1.04641],
[1357322640000,1.04643],
[1357322700000,1.04645],
[1357322760000,1.04648],
[1357322820000,1.04651],
[1357322880000,1.04654],
[1357322940000,1.04657],
[1357323000000,1.0466],
[1357323060000,1.04661],
[1357323120000,1.04664],
[1357323180000,1.04666],
[1357323240000,1.04667],
[1357323300000,1.04669],
[1357323360000,1.04669],
[1357323420000,1.0467],
[1357323480000,1.04669],
[1357323540000,1.04668],
[1357323600000,1.04668],
[1357323660000,1.04667],
[1357323720000,1.04666],
[1357323780000,1.04665],
[1357323840000,1.04664],
[1357323900000,1.04664],
[1357323960000,1.04663],
[1357324020000,1.04663],
[1357324080000,1.04663],
[1357324140000,1.04663],
[1357324200000,1.04663],
[1357324260000,1.04663],
[1357324320000,1.04663],
[1357324380000,1.04664],
[1357324440000,1.04665],
[1357324500000,1.04666],
[1357324560000,1.04667],
[1357324620000,1.04668],
[1357324680000,1.04669],
[1357324740000,1.04671],
[1357324800000,1.04672],
[1357324860000,1.04672],
[1357324980000,1.04673],
[1357325040000,1.04673],
[1357325100000,1.04675],
[1357325160000,1.04677],
[1357325220000,1.04679],
[1357325280000,1.04681],
[1357325340000,1.04684],
[1357325400000,1.04686],
[1357325520000,1.04688],
[1357325580000,1.04689],
[1357325640000,1.04691],
[1357325700000,1.04691],
[1357325760000,1.04693],
[1357325820000,1.04694],
[1357325880000,1.04697],
[1357328520000,1.04757],
[1357328580000,1.04755],
[1357328640000,1.04752],
[1357328700000,1.0475],
[1357328760000,1.04748],
[1357328820000,1.04747],
[1357328880000,1.04745],
[1357328940000,1.04743],
[1357329000000,1.04742],
[1357329060000,1.04741],
[1357329120000,1.04741],
[1357329180000,1.0474],
[1357329240000,1.04739],
[1357329300000,1.04737],
[1357329360000,1.04734],
[1357329420000,1.04733],
[1357329480000,1.04731],
[1357329540000,1.0473],
[1357329600000,1.0473],
[1357329660000,1.04729],
[1357329720000,1.04728],
[1357329780000,1.04728],
[1357329840000,1.04727],
[1357329900000,1.04727],
[1357329960000,1.04727],
[1357330080000,1.04727],
[1357330140000,1.04728],
[1357330200000,1.04731],
[1357330260000,1.04734],
[1357330320000,1.04739],
[1357330380000,1.04745],
[1357330440000,1.04754],
[1357330500000,1.04763],
[1357330560000,1.04771],
[1357330620000,1.04779],
[1357330680000,1.04787],
[1357330740000,1.04795],
[1357330800000,1.04803],
[1357330860000,1.04812],
[1357330980000,1.0482],
[1357331040000,1.04829],
[1357331100000,1.04835],
[1357331160000,1.0484],
[1357331220000,1.04844],
[1357331280000,1.04848],
[1357331340000,1.04848],
[1357331400000,1.04848],
[1357331460000,1.04848],
[1357331520000,1.04848],
[1357331580000,1.04848],
[1357331640000,1.04847],
[1357331700000,1.04846],
[1357331760000,1.04845],
[1357331820000,1.04843],
[1357331880000,1.04842],
[1357331940000,1.04841],
[1357332060000,1.04841],
[1357332120000,1.04842],
[1357332180000,1.04841],
[1357332240000,1.04839],
[1357332300000,1.04836],
[1357332360000,1.04834],
] 

点の集合です: [ [x,y],[x,y]... ]。

このスクリプトは系列 (series[3]) をチャートと名前に追加しましたが、データセットは空で、xDate と yData セットもありません。

Console.log(グラフ):

$a {plotBox: Object, tooltip: yb, clipRect: Ga, plotLeft: 10, chartSubtitleOptions: Object…}
_sharedClip1000undefined: null
_sharedClip1000undefinedm: null
addSeries: function (a,b,c){var d,e=this;a&&(Fa(c,e),b=p(b,!0),J(e,"addSeries",{options:a},function(){d=e.initSeries(a);e.isDirtyLegend=!0;b&&e.redraw()}));return d}
angular: undefined
animation: true
axes: Array[4]
axisOffset: Array[4]
callback: undefined
chartBackground: Ga
chartHeight: 385
chartSubtitleOptions: Object
chartTitleOptions: Object
chartWidth: 816
clipBox: Object
clipRect: Ga
container: <div>
containerHeight: 385
containerWidth: 816
counters: Lb
credits: Ga
detachedaddSeries: null
detachedinit: null
detachedredraw: null
extraBottomMargin: 64
hasCartesianSeries: true
hasRendered: true
hoverPoint: null
hoverPoints: null
hoverSeries: null
init: function (a){var b=this.options.chart,c;b.reflow!==!1&&D(this,"load",
inverted: undefined
isDirtyBox: false
isDirtyLegend: true
isResizing: 0
jQuery18208388212455902249: Object
legend: Ab
marginBottom: 94
marginRight: 10
maxTicks: null
options: Object
optionsMarginBottom: undefined
optionsMarginLeft: undefined
optionsMarginRight: undefined
optionsMarginTop: undefined
pan: function (a){var d=b.xAxis[0],h=!1;if(d.options.ordinal&&d.series.length){var i=b.mouseDownX,j=d.getExtremes(),k=j.dataMax,l=j.min,m=j.max,o;o=b.hoverPoints;
plotBorderWidth: 0
plotBox: Object
plotHeight: 281
plotLeft: 10
plotSizeX: 796
plotSizeY: 281
plotTop: 10
plotWidth: 796
pointCount: 486
polar: undefined
redraw: function (a){var b=this.axes,c=this.series,d=this.tracker,e=this.legend,f=this.isDirtyLegend,g,h=this.isDirtyBox,i=c.length,j=i,k=this.renderer,l=k.isHidden(),m=[];Fa(a,this);for(l&&this.cloneRenderTo();j--;)if(a=c[j],a.isDirty&&a.options.stacking){g=!0;break}if(g)for(j=i;j--;)if(a=c[j],a.options.stacking)a.isDirty=!0;n(c,function(a){a.isDirty&&a.options.legendType==="point"&&(f=!0)});if(f&&e.options.enabled)e.render(),this.isDirtyLegend=
renderTo: <div>
renderer: pa
runChartClick: undefined
scroller: Pb
series: Array[3]
0: c
chart: $a
closestPointRange: 3600000
color: "#4572A7"
columnIndex: 0
cropStart: 0
cropped: undefined
currentDataGrouping: Object
data: Array[0]
forceCrop: true
group: Ga
groupedData: Array[70]
hasGroupedData: true
hasRendered: true
index: 0
isDirty: false
isDirtyData: false
jQuery18208388212455902249: Object
markerGroup: Ga
name: "AUDUSD"
options: Object
pointAttr: Array[0]
pointRange: 3600000
points: Array[70]
processedXData: Array[70]
processedYData: Array[70]
segments: Array[1]
selected: false
state: ""
tooltipOptions: Object
tooltipPoints: Array[797]
trackerGroup: Ga
translatedThreshold: 281
visible: true
xAxis: Sa
xData: Array[4096]
xIncrement: null
yAxis: Sa
yData: Array[4096]
__proto__: c
1: c
animate: null
animationTimeout: 3162
area: Ga
areaPath: Array[2914]
chart: $a
closestPointRange: 600000
color: "#4572A7"
cropStart: 0
cropped: undefined
currentDataGrouping: Object
data: Array[0]
forceCrop: true
graph: Ga
graphPath: Array[2908]
group: Ga
groupedData: Array[416]
hasGroupedData: true
hasRendered: true
index: 1
isDirty: false
isDirtyData: false
jQuery18208388212455902249: Object
markerGroup: Ga
name: "Navigator"
options: Object
pointAttr: Array[0]
pointRange: 0
points: Array[416]
processedXData: Array[416]
processedYData: Array[416]
segments: Array[1]
selected: false
sharedClipKey: "_sharedClip1000undefined"
singlePoints: Array[0]
state: ""
symbol: "circle"
tooltipOptions: Object
visible: true
xAxis: Sa
xData: Array[4096]
xIncrement: null
yAxis: Sa
yData: Array[4096]
__proto__: c
2: c
animate: null
animationTimeout: 3259
chart: $a
_sharedClip1000undefined: null
_sharedClip1000undefinedm: null
addSeries: function (a,b,c){var d,e=this;a&&(Fa(c,e),b=p(b,!0),J(e,"addSeries",{options:a},function(){d=e.initSeries(a);e.isDirtyLegend=!0;b&&e.redraw()}));return d}
angular: undefined
animation: true
axes: Array[4]
axisOffset: Array[4]
callback: undefined
chartBackground: Ga
chartHeight: 385
chartSubtitleOptions: Object
chartTitleOptions: Object
chartWidth: 816
clipBox: Object
clipRect: Ga
container: <div>
containerHeight: 385
containerWidth: 816
counters: Lb
credits: Ga
detachedaddSeries: null
detachedinit: null
detachedredraw: null
extraBottomMargin: 64
hasCartesianSeries: true
hasRendered: true
hoverPoint: null
hoverPoints: null
hoverSeries: null
init: function (a){var b=this.options.chart,c;b.reflow!==!1&&D(this,"load",
inverted: undefined
isDirtyBox: false
isDirtyLegend: true
isResizing: 0
jQuery18208388212455902249: Object
legend: Ab
marginBottom: 94
marginRight: 10
maxTicks: null
options: Object
optionsMarginBottom: undefined
optionsMarginLeft: undefined
optionsMarginRight: undefined
optionsMarginTop: undefined
pan: function (a){var d=b.xAxis[0],h=!1;if(d.options.ordinal&&d.series.length){var i=b.mouseDownX,j=d.getExtremes(),k=j.dataMax,l=j.min,m=j.max,o;o=b.hoverPoints;
plotBorderWidth: 0
plotBox: Object
plotHeight: 281
plotLeft: 10
plotSizeX: 796
plotSizeY: 281
plotTop: 10
plotWidth: 796
pointCount: 486
polar: undefined
redraw: function (a){var b=this.axes,c=this.series,d=this.tracker,e=this.legend,f=this.isDirtyLegend,g,h=this.isDirtyBox,i=c.length,j=i,k=this.renderer,l=k.isHidden(),m=[];Fa(a,this);for(l&&this.cloneRenderTo();j--;)if(a=c[j],a.isDirty&&a.options.stacking){g=!0;break}if(g)for(j=i;j--;)if(a=c[j],a.options.stacking)a.isDirty=!0;n(c,function(a){a.isDirty&&a.options.legendType==="point"&&(f=!0)});if(f&&e.options.enabled)e.render(),this.isDirtyLegend=
renderTo: <div>
renderer: pa
runChartClick: undefined
scroller: Pb
series: Array[3]
seriesGroup: Ga
setSize: function (e,f,g){a.top=h=a.getAxisTop(f);if(c&&d)c.options.top=d.options.top=h;r.call(b,e,f,g)}
spacingBox: Object
tooltip: yb
tracker: zb
trackerGroup: Ga
xAxis: Array[2]
yAxis: Array[2]
__proto__: Object
closestPointRange: undefined
color: "#AA4643"
cropStart: 0
cropped: undefined
currentDataGrouping: null
data: Array[0]
forceCrop: true
graph: Ga
graphPath: Array[0]
group: Ga
groupedData: null
hasGroupedData: undefined
hasRendered: true
index: 2
isDirty: false
isDirtyData: false
jQuery18208388212455902249: Object
markerGroup: Ga
name: "Series 3"
options: Object
pointAttr: Array[0]
pointRange: 0
points: Array[0]
processedXData: Array[0]
processedYData: Array[0]
segments: Array[0]
selected: false
sharedClipKey: "_sharedClip1000undefined"
singlePoints: Array[0]
state: ""
symbol: "diamond"
tooltipOptions: Object
tooltipPoints: Array[0]
tracker: Ga
trackerGroup: Ga
visible: true
xAxis: Sa
xData: Array[0]
xIncrement: null
yAxis: Sa
yData: Array[0]
__proto__: W
length: 3
__proto__: Array[0]
seriesGroup: Ga
setSize: function (e,f,g){a.top=h=a.getAxisTop(f);if(c&&d)c.options.top=d.options.top=h;r.call(b,e,f,g)}
spacingBox: Object
tooltip: yb
tracker: zb
trackerGroup: Ga
xAxis: Array[2]
yAxis: Array[2]
__proto__: Object

Java メソッドを使用してデータを取得しています。

@RequestMapping(value = "/indicator", method = RequestMethod.GET)
public @ResponseBody
String getHitoricalIndicator(@RequestParam("indicator") String indicator2,
        @RequestParam("period") String period,
        @RequestParam("currency") String currency) {
    JSONObject js = new JSONObject();
    System.out.println(indicator2 + period + currency);
    Indicators ind = new Indicators();
    String pe = null;
    if (period.equals("1"))
        pe = PERIOD_CODE.PERIOD_M1.toString();
    if (period.equals("15"))
        pe = PERIOD_CODE.PERIOD_M15.toString();
    if (period.equals("30"))
        pe = PERIOD_CODE.PERIOD_M30.toString();
    if (period.equals("60"))
        pe = PERIOD_CODE.PERIOD_H1.toString();
    if (period.equals("240"))
        pe = PERIOD_CODE.PERIOD_H4.toString();
    if (period.equals("1440"))
        pe = PERIOD_CODE.PERIOD_D1.toString();
    Currency cur = sc.getCurrencies().get(currency);
    Period p = cur.data.get(pe);
    long[] timestamp = new long[p.size];
    double[] close = new double[p.size];
    int l = 0;
    for (CandleStick r : p.list) {
        timestamp[l] = r.getTimestamp();
        close[l] = r.getClose();
        l++;
    }
    double[] results = ind.SMA(Indicators.standardPeriod, close);

    String responseCandle = "[";
    int g = results.length;
    int licz = 0;
    for (int w = 0; w < results.length; w++) {
        responseCandle = responseCandle + "[" + Long.toString(timestamp[w])
                + ", " + Double.toString(results[w]);
        if (licz + 1 == g)
            responseCandle = responseCandle + "]";
        else
            responseCandle = responseCandle + "], ";
        licz++;
    }
    responseCandle = responseCandle + "]";

    logger.info(responseCandle);
    js.put("dane", responseCandle);

    return responseCandle;
}

セリエをチャートに追加する別の方法を知っていますか?

探しましたが、反応がありませんでした。

私を助けてください。

マテウス。

4

2 に答える 2

1

このaddSeriesメソッドは、配列ではなくオブジェクトを受け入れます。

したがって、呼び出しは代わりに次のようになります。

chart.addSeries({
    type : 'line',
    name : 'wskaznik',
    data : data
}, true, true);
于 2013-01-05T19:11:49.243 に答える
0

解決策を見つけました。

$.ajax と $.getJSON の違いです。

解決!

$.getJSON('candlestick', {
        currency : $("#selectionField3").val(),
        period : $("#selectionField2 option:selected").val()
    }, function(data) {
        chart = new Highcharts.StockChart({
            chart : {
                renderTo : 'chart'
            },
            rangeSelector : false,
            // title : {
            // text : 'Candlestick Chart'
            // },

            series : [ {
                type : 'candlestick',
                name : $("#selectionField3").val(),
                data : data,
            } ],
        }); 

$.json のレスポンスはテキスト型ですが、$.getJSON は配列型のようなものです。

ご関心をお寄せいただきありがとうございます。

キング様、

マテウシュ・ヤルムゼク

于 2013-01-05T20:50:37.120 に答える