Add support for a new curve data format in the Curves package converter system
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Create a custom JavaScript viewer extending DG.JsViewer with properties and rendering
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
설치 방법 보기설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.
Help the user develop a custom interactive viewer for Datagrok by extending DG.JsViewer.
/create-custom-viewer [viewer-name] [--library <d3|echarts|plotly>]
From the package directory:
grok add viewer <ViewerName>
This creates a viewer class file. The naming convention is to add a Viewer postfix to the class name (e.g., AwesomeViewer).
Create a subclass of DG.JsViewer in a separate file (e.g., src/awesome-viewer.ts):
import * as DG from 'datagrok-api/dg';
import * as ui from 'datagrok-api/ui';
export class AwesomeViewer extends DG.JsViewer {
constructor() {
super();
// Register properties (appear in the context panel)
this.splitColumnName = this.string('splitColumnName', 'site');
this.valueColumnName = this.int('valueColumnName', 'age');
this.valueAggrType = this.string('valueAggrType', 'avg', { choices: ['avg', 'count', 'sum'] });
this.color = this.string('color', 'steelblue', { choices: ['darkcyan', 'seagreen', 'steelblue'] });
this.initialized = false;
}
onTableAttached() {
this.init();
this.subs.push(DG.debounce(this.dataFrame.selection.onChanged, 50).subscribe((_) => this.render()));
this.subs.push(DG.debounce(this.dataFrame.filter.onChanged, 50).subscribe((_) => this.render()));
this.subs.push(DG.debounce(ui.onSizeChanged(this.root), 50).subscribe((_) => this.render(false)));
this.render();
}
detach() {
this.subs.forEach(sub => sub.unsubscribe());
}
onPropertyChanged(property) {
super.onPropertyChanged(property);
if (this.initialized)
this.render();
}
render(computeData = true) {
// Rendering logic here
}
}
In src/package.ts, add the annotated function:
import {AwesomeViewer} from './awesome-viewer';
//name: AwesomeViewer
//description: Creates an awesome viewer
//tags: viewer
//meta.icon: images/icon.svg
//meta.toolbox: true
//meta.trellisable: true
//output: viewer result
export function awesome() {
return new AwesomeViewer();
}
Or use the decorator approach (requires datagrok-tools >= 4.12.x):
@grok.decorators.viewer({
icon: 'images/icon.png',
toolbox: true,
})
export class AwesomeViewer extends DG.JsViewer { /* ... */ }
Available property types in the constructor:
this.int(name, defaultValue, options) -- integerthis.float(name, defaultValue, options) -- floating pointthis.string(name, defaultValue, options) -- stringthis.stringList(name, defaultValue, options) -- string arraythis.bool(name, defaultValue, options) -- booleanthis.dateTime(name, defaultValue, options) -- datetimeProperty grouping in the UI is determined by naming:
Data tab: properties ending with ColumnNameColors tab: properties ending with colorAxes tab: properties containing axisLegend tab: properties starting with legendMargins tab: properties containing marginMisc tab: everything elseA viewer registered with //meta.trellisable: true can also name the properties that belong on the
trellis plot's control panel — the strip beside the inner-viewer selector, where a scatter plot
offers X, Y, Color and Size:
get trellisProperties(): string[] { return ['mergeColumnSeries', 'logX', 'logY']; }
The first four are shown, in the order given, and unknown names are skipped. A viewer that declares none gets no strip; its properties are still editable in the context panel, under a tab named after the viewer.
Always respect the dataframe filter when preparing data:
render(computeData = true) {
if (computeData) {
this.data.length = 0;
this.aggregatedTable = this.dataFrame
.groupBy([this.splitColumnName])
.whereRowMask(this.dataFrame.filter)
.add(this.valueAggrType, this.valueColumnName, 'result')
.aggregate();
// Process aggregated data...
}
// Render using this.root as the container
}
Add tooltips and selection handling to visual elements:
// Row group tooltips on hover
element.on('mouseover', (event, d) => ui.tooltip.showRowGroup(this.dataFrame, i => {
return d.category === this.dataFrame.getCol(this.splitColumnName).get(i);
}, event.x, event.y));
element.on('mouseout', () => ui.tooltip.hide());
// Selection on click
element.on('mousedown', (event, d) => {
this.dataFrame.selection.handleClick(i => {
return d.category === this.dataFrame.getCol(this.splitColumnName).get(i);
}, event);
});
Add libraries (e.g., D3, ECharts) to package.json dependencies. Do NOT add platform-provided externals (datagrok-api, rxjs, cash-dom, dayjs, wu, openchemlib/full) to your bundle.
npm run build
grok publish dev
Test with: grok.shell.addTableView(grok.data.demo.demog()).addViewer('AwesomeViewer');
this.subs so they are cleaned up when the viewer is detached.DG.debounce on frequently firing events (selection, filter, resize) for performance.아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.
로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.
아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.
Add support for a new curve data format in the Curves package converter system
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Create info panels that appear in the context panel based on semantic types
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Add a new single-objective optimization algorithm to the sci-comp library. Use when the user asks to implement a new optimizer (e.g. gradient descent, BFGS, simulated annealing, differential evolution).
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Add unit tests to a Datagrok package
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Answer a "how do I …" question about the platform with a Gherkin scenario on @datagrok-libraries/bdd that is filmed into a how-to video (grok-bdd guide), so the answer is demonstrated, sent as a video plus numbered steps, and kept as a regression test; the same scenarios, filmed in help mode, are the GIFs of the help pages
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Translate hand-written Playwright specs (or any existing UI tests) into Gherkin features on @datagrok-libraries/bdd, then prove the features test what they claim by backward-matching them against the originals with independent reviewers, and fix the gaps in the core, the library and the features
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.