ABTSoftware / SciChart.JS.Examples

MIT License
84 stars 37 forks source link

BoxAnnotation issues on vertical mode #27

Closed hecto932 closed 3 years ago

hecto932 commented 3 years ago

Hey guys, here me again.

Currently, I think I found a bug using box annotation on Vertical mode. I'm using Box Annotation to mark some specific area on the chart.

Initial setup for scichart surface is:

const draw = async (divElem: string, orientation: string = 'vertical', columns: Array<string> = [], data: Array<any> = []) => {
  const apiKey: string = process.env.REACT_APP_SCICHART_KEY || '';

  SciChartSurface.setRuntimeLicenseKey(apiKey);

  const { sciChartSurface, wasmContext } = await SciChartSurface.create(divElem);

  const xAxis = new NumericAxis(wasmContext);
  const yAxis = new NumericAxis(wasmContext);

  xAxis.labelProvider.formatLabel = formatAxis;
  yAxis.labelProvider.formatLabel = numberToFix;

  if (orientation === 'vertical') {
    // SET VERTICAL ORIENTATION BY DEFAULT
    xAxis.axisAlignment = EAxisAlignment.Left;
    yAxis.axisAlignment = EAxisAlignment.Bottom;

    // An axis may be optionally flipped using flippedCoordinates property
    yAxis.flippedCoordinates = true;
  } else {
    xAxis.axisAlignment = EAxisAlignment.Bottom;
    yAxis.axisAlignment = EAxisAlignment.Left;

    // An axis may be optionally flipped using flippedCoordinates property
    yAxis.flippedCoordinates = false;
  }

  // ADDING AXES TO SURFACE
  sciChartSurface.xAxes.add(xAxis);
  sciChartSurface.yAxes.add(yAxis);

  return { sciChartSurface, wasmContext };
};

For example on vertical mode is happening:

 // VERTICAL 
new BoxAnnotation({
  fill: '#FF191955',
  strokeThickness: 0,
  yCoordinateMode: ECoordinateMode.DataValue,
  y1: 200.0,
  y2: 300.0,
  xCoordinateMode: ECoordinateMode.Relative,
  x1: 0.0,
  x2: 1.0,
})

image

But in Horizontal mode is working fine:

image

Could you help me with this?

If you need more details please don't hesitate to ask me

klishevich commented 3 years ago

Hi @hecto932, thank you for reporting the bug. We have fixed it in version 1.1.1369. Cheers :)