org.eclipse.scada.chart.YAxis.translateToClient()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(78)

本文整理了Java中org.eclipse.scada.chart.YAxis.translateToClient()方法的一些代码示例,展示了YAxis.translateToClient()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YAxis.translateToClient()方法的具体详情如下:
包路径:org.eclipse.scada.chart.YAxis
类名称:YAxis
方法名:translateToClient

YAxis.translateToClient介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.neoscada.chart/org.eclipse.scada.chart.swt

protected static boolean translateToPoint ( final Rectangle clientRect, final XAxis x, final YAxis y, final DataPoint point, final DataEntry entry )
{
  // we always need X
  point.x = clientRect.x + x.translateToClient ( clientRect.width, entry.getTimestamp () );
  final Double value = entry.getValue ();
  if ( value == null || Double.isNaN ( value ) || Double.isInfinite ( value ) )
  {
    return false;
  }
  // we only provide Y if we really have a value
  point.y = clientRect.y + y.translateToClient ( clientRect.height, value );
  return true;
}

代码示例来源:origin: de.dentrassi.eclipse.neoscada.chart/org.eclipse.scada.chart.swt

protected static boolean translateToPoint ( final Rectangle clientRect, final XAxis x, final YAxis y, final DataPoint point, final DataEntry entry )
{
  // we always need X
  point.x = clientRect.x + x.translateToClient ( clientRect.width, entry.getTimestamp () );
  final Double value = entry.getValue ();
  if ( value == null || Double.isNaN ( value ) || Double.isInfinite ( value ) )
  {
    return false;
  }
  // we only provide Y if we really have a value
  point.y = clientRect.y + y.translateToClient ( clientRect.height, value );
  return true;
}

代码示例来源:origin: de.dentrassi.eclipse.neoscada.chart/org.eclipse.scada.chart.swt

@Override
protected void doRender ( final Graphics g, final Rectangle clientRectangle )
{
  if ( this.axis == null )
  {
    return;
  }
  final Double position = getPosition ();
  if ( position == null )
  {
    return;
  }
  final int y = (int)this.axis.translateToClient ( clientRectangle.height, getPosition () );
  if ( ( this.style & SWT.TOP ) > 0 )
  {
    g.fillRectangle ( clientRectangle.x, clientRectangle.y, clientRectangle.width, y );
  }
  else if ( ( this.style & SWT.BOTTOM ) > 0 )
  {
    g.fillRectangle ( clientRectangle.x, y, clientRectangle.width, clientRectangle.height - y );
  }
  else
  {
    if ( y < 0 || y > clientRectangle.width )
    {
      return;
    }
    g.drawLine ( clientRectangle.x, clientRectangle.y + y, clientRectangle.width, clientRectangle.y + y );
  }
}

代码示例来源:origin: org.eclipse.neoscada.chart/org.eclipse.scada.chart.swt

@Override
protected void doRender ( final Graphics g, final Rectangle clientRectangle )
{
  if ( this.axis == null )
  {
    return;
  }
  final Double position = getPosition ();
  if ( position == null )
  {
    return;
  }
  final int y = (int)this.axis.translateToClient ( clientRectangle.height, getPosition () );
  if ( ( this.style & SWT.TOP ) > 0 )
  {
    g.fillRectangle ( clientRectangle.x, clientRectangle.y, clientRectangle.width, y );
  }
  else if ( ( this.style & SWT.BOTTOM ) > 0 )
  {
    g.fillRectangle ( clientRectangle.x, y, clientRectangle.width, clientRectangle.height - y );
  }
  else
  {
    if ( y < 0 || y > clientRectangle.width )
    {
      return;
    }
    g.drawLine ( clientRectangle.x, clientRectangle.y + y, clientRectangle.width, clientRectangle.y + y );
  }
}

相关文章