Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions src/core/prototypes/plot_segments/region_2d/polar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
Region2DSublayoutType,
} from "./base";
import { PlotSegmentClass } from "../plot_segment";
import { getSortDirection } from "../../..";
import { getSortDirection, SpecTypes } from "../../..";
import { ChartStateManager } from "../..";
import { strings } from "../../../../strings";
import { AxisDataBinding } from "../../../specification/spec_types";
Expand Down Expand Up @@ -481,6 +481,12 @@ export class PolarPlotSegment extends PlotSegmentClass<
true,
this.getDisplayFormat(props.yData, props.yData.tickFormat, manager)
);
if (props.yData.tickDataExpression) {
axisRenderer.setTicksByData(
this.getTickData(props.yData, manager),
props.yData.tickFormat
);
}
g.elements.push(
axisRenderer.renderLine(
center.cx,
Expand All @@ -499,6 +505,12 @@ export class PolarPlotSegment extends PlotSegmentClass<
false,
this.getDisplayFormat(props.xData, props.xData.tickFormat, manager)
);
if (props.xData.tickDataExpression) {
axisRenderer.setTicksByData(
this.getTickData(props.xData, manager),
props.xData.tickFormat
);
}
g.elements.push(
axisRenderer.renderPolar(
center.cx,
Expand All @@ -512,6 +524,26 @@ export class PolarPlotSegment extends PlotSegmentClass<
return g;
}

private getTickData = (
axis: SpecTypes.AxisDataBinding,
manager: ChartStateManager
) => {
manager;
const table = manager.getTable(this.object.table);
const axisExpression = manager.dataflow.cache.parse(axis.expression);
const tickDataExpression = manager.dataflow.cache.parse(
axis.tickDataExpression
);
const result = [];
for (let i = 0; i < table.rows.length; i++) {
const c = table.getRowContext(i);
const axisValue = axisExpression.getValue(c);
const tickData = tickDataExpression.getValue(c);
result.push({ value: axisValue, tick: tickData });
}
return result;
};

public getPlotSegmentBackgroundGraphics(
manager: ChartStateManager
): Graphics.Group {
Expand Down Expand Up @@ -868,7 +900,7 @@ export class PolarPlotSegment extends PlotSegmentClass<
label: strings.objects.plotSegment.inner,
showUpdown: true,
step: 0.1
}
}
),
manager.inputNumber(
{ property: "outerRatio" },
Expand Down
Loading