Search in sources :

Example 1 with RunChartDownsampleRequest

use of io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.RunChartDownsampleRequest in project deephaven-core by deephaven.

the class JsTable method downsample.

public Promise<JsTable> downsample(LongWrapper[] zoomRange, int pixelCount, String xCol, String[] yCols) {
    JsLog.info("downsample", zoomRange, pixelCount, xCol, yCols);
    final String fetchSummary = "downsample(" + Arrays.toString(zoomRange) + ", " + pixelCount + ", " + xCol + ", " + Arrays.toString(yCols) + ")";
    return workerConnection.newState((c, state, metadata) -> {
        RunChartDownsampleRequest downsampleRequest = new RunChartDownsampleRequest();
        downsampleRequest.setPixelCount(pixelCount);
        if (zoomRange != null) {
            ZoomRange zoom = new ZoomRange();
            zoom.setMinDateNanos(Long.toString(zoomRange[0].getWrapped()));
            zoom.setMaxDateNanos(Long.toString(zoomRange[1].getWrapped()));
            downsampleRequest.setZoomRange(zoom);
        }
        downsampleRequest.setXColumnName(xCol);
        downsampleRequest.setYColumnNamesList(yCols);
        downsampleRequest.setSourceId(state().getHandle().makeTableReference());
        downsampleRequest.setResultId(state.getHandle().makeTicket());
        workerConnection.tableServiceClient().runChartDownsample(downsampleRequest, workerConnection.metadata(), c::apply);
    }, fetchSummary).refetch(this, workerConnection.metadata()).then(state -> Promise.resolve(new JsTable(workerConnection, state)));
}
Also used : RunChartDownsampleRequest(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.RunChartDownsampleRequest) ZoomRange(io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.runchartdownsamplerequest.ZoomRange)

Aggregations

RunChartDownsampleRequest (io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.RunChartDownsampleRequest)1 ZoomRange (io.deephaven.javascript.proto.dhinternal.io.deephaven.proto.table_pb.runchartdownsamplerequest.ZoomRange)1