List of usage examples for com.google.gwt.core.client JsArrayNumber set
public final native void set(int index, double value) ;
From source file:com.googlecode.gflot.client.options.LegendOptions.java
License:Open Source License
/** * Set the distance to the plot edge/* w w w .jav a2 s . c o m*/ */ public final LegendOptions setMargin(double marginX, double marginY) { JsArrayNumber array = getMarginAsArray(); if (null == array) { array = JavaScriptObject.createArray().cast(); put(MARGIN_KEY, array); } array.set(0, marginX); array.set(1, marginY); return this; }
From source file:com.googlecode.gwt.charts.client.ajaxloader.ArrayHelper.java
License:Apache License
/** * Converts a Java array of doubles to a JavaScript number array. * /* w ww . jav a 2 s.c o m*/ * @param numbers array of doubles to convert. */ public static JsArrayNumber toJsArrayNumber(double... numbers) { JsArrayNumber result = JsArrayNumber.createArray().cast(); for (int i = 0; i < numbers.length; i++) { result.set(i, numbers[i]); } nativePatchConstructorForSafari(result); return result; }
From source file:org.openremote.manager.client.interop.chartjs.ChartUtil.java
License:Open Source License
static public JsArrayNumber convertData(NumberDatapoint[] numberDatapoints) { JsArrayNumber array = (JsArrayNumber) JsArrayNumber.createArray(); for (int i = 0; i < numberDatapoints.length; i++) { NumberDatapoint numberDatapoint = numberDatapoints[i]; array.set(i, numberDatapoint.getNumber().doubleValue()); }/*from ww w. j av a 2s. com*/ return array; }
From source file:org.thechiselgroup.choosel.protovis.client.StreamgraphExample.java
License:Apache License
private void bump(JsArrayNumber a, int m) { double x = 1d / (.1 + Math.random()); double y = 2d * Math.random() - .5; double z = 10d / (.1 + Math.random()); for (int i = 0; i < m; i++) { double w = (((double) i) / m - y) * z; a.set(i, a.get(i) + x * Math.exp(-w * w)); }/*from w ww.j a v a 2s .c o m*/ }
From source file:org.thechiselgroup.choosel.protovis.client.StreamgraphExample.java
License:Apache License
private JsArrayGeneric<JsArrayNumber> generateData(int n, int m) { JsArrayGeneric<JsArrayNumber> result = JsUtils.createJsArrayGeneric(); for (int i = 0; i < n; i++) { JsArrayNumber a = JsUtils.createJsArrayNumber(); for (int j = 0; j < m; j++) { a.set(j, 0); }/*from ww w . java2s.c o m*/ for (int j = 0; j < 5; j++) { bump(a, m); } result.push(a); } return result; }
From source file:org.turbogwt.core.collections.JsArrays.java
License:Apache License
public static JsArrayNumber fromArray(double... values) { if (GWT.isScript()) { return reinterpretCast(values); } else {//from w w w . ja v a 2 s .c o m JsArrayNumber ret = JavaScriptObject.createArray().cast(); for (int i = 0, l = values.length; i < l; i++) { ret.set(i, values[i]); } return ret; } }
From source file:thothbot.parallax.core.client.gl2.arrays.JsArrayUtil.java
License:Apache License
/** * Wraps a Java double Array to a JsArrayNumber. * /*from ww w . j av a 2 s . c o m*/ * @param srcArray * the array to wrap * @return the wrapped array */ public static JsArrayNumber wrapArray(double[] srcArray) { if (GWT.isScript()) { return arrayAsJsArrayForProdMode(srcArray); } JsArrayNumber result = JavaScriptObject.createArray().cast(); for (int i = 0; i < srcArray.length; i++) { result.set(i, srcArray[i]); } return result; }