Skip to main content

DisjointChannelAnnotation

DisjointChannelAnnotation📘 calculates the fourth point so points 3 and 4 mirror points 1 and 2. This allows disjoint channel edges while preserving a clear relationship between the two sides.

const {
NumberRange,
NumericAxis,
SciChartSurface,
EVerticalTextPosition
} = SciChart; // or import from "scichart"
const {
DisjointChannelAnnotation,
EAnnotationVisibilityMode,
EMultiPointLabelAnchorMode,
SciTraderLightTheme
} = SciChartFinancialTools; // if using npm, import from "scichart-financial-tools";

const { wasmContext, sciChartSurface } = await SciChartSurface.create(divElementId, {
theme: new SciTraderLightTheme()
});

sciChartSurface.xAxes.add(new NumericAxis(wasmContext, { visibleRange: new NumberRange(0, 50) }));
sciChartSurface.yAxes.add(new NumericAxis(wasmContext, { visibleRange: new NumberRange(20, 90) }));

sciChartSurface.annotations.add(
new DisjointChannelAnnotation({
// First two points define one channel edge; the third point defines the offset.
points: [
{ x: 8, y: 60 },
{ x: 42, y: 80 },
{ x: 42, y: 50 },
],
stroke: "#338888",
fill: "#33888833",
showMidLine: false,
showMidPointGrips: false,

// other properties:
isEditable: true,
isSelected: true,
labels: [
// Segment labels can name each edge independently.
{
anchorMode: EMultiPointLabelAnchorMode.Segment,
verticalTextPosition: EVerticalTextPosition.Above,
segmentStartIndex: 0,
segmentEndIndex: 1,
segmentRatio: 0.5,
text: "Resistance"
},
{
anchorMode: EMultiPointLabelAnchorMode.Segment,
verticalTextPosition: EVerticalTextPosition.Below,
segmentStartIndex: 2,
segmentEndIndex: 3,
segmentRatio: 0.5,
text: "Support"
}
],
segmentLabelVisibility: EAnnotationVisibilityMode.Always
})
);

The third point uses a special square drag grip and moves along the Y axis, making the offset role visible while editing.

See Also​