Package org.krysalis.jcharts.chartText

Examples of org.krysalis.jcharts.chartText.TextTag


   * @param axisValueRenderEvent
   ***********************************************************************************/
  public void postRender( AxisValueRenderEvent axisValueRenderEvent )
  {
    AxisChart axisChart = (AxisChart) axisValueRenderEvent.getSource();
    TextTag valueTag;
    float x;
    float y;


    if( axisValueRenderEvent.getiAxisPlotDataSet() instanceof IAxisChartDataSet )
    {
      IAxisChartDataSet iAxisChartDataSet = (IAxisChartDataSet) axisValueRenderEvent.getiAxisPlotDataSet();
      double value = iAxisChartDataSet.getValue( axisValueRenderEvent.getDataSetIndex(), axisValueRenderEvent.getValueIndex() );

      valueTag = new TextTag( this.numberFormat.format( value ),
                      this.valueChartFont.getFont(),
                      this.derivedFont,
                      axisValueRenderEvent.getFontRenderContext() );

      if( axisChart.getAxisProperties().isPlotHorizontal() )
      {
        x = this.calculateXHorizontalPlot( axisValueRenderEvent, valueTag, (value < 0) );
        y = this.calculateYHorizontalPlot( axisValueRenderEvent, valueTag );
      }
      else
      {
        x = this.calculateXVerticalPlot( axisValueRenderEvent, valueTag );
        y = this.calculateYVerticalPlot( axisValueRenderEvent, valueTag, (value < 0) );
      }
    }
    else
    {
//todo scatter and hi/low
      valueTag = null;
      x = 100;
      y = 100;

      throw new RuntimeException( "Axis Values not yet implemented for this type of chart." );
    }


/*
    Line2D.Float line= new Line2D.Float( x, y, x, y -20 );
    axisValueRenderEvent.getGraphics2D().draw( line );
*/

    valueTag.setXPosition( x );
    valueTag.setYPosition( y );
    valueTag.render( axisValueRenderEvent.getGraphics2D(), this.valueChartFont.getPaint() );
  }
View Full Code Here


   * @param font
   * @param fontRenderContext
   *******************************************************************************************/
  public void addLabel( String label, Font font, FontRenderContext fontRenderContext )
  {
    TextTag textTag= new TextTag( label, font, fontRenderContext );
    this.textTags.add( textTag );

    this.widestLabel = Math.max( textTag.getWidth(), this.widestLabel );
    this.totalLabelWidths += textTag.getWidth();

    this.tallestLabel = Math.max( textTag.getHeight(), this.tallestLabel );
  }
View Full Code Here

   * @param font
   * @param fontRenderContext
   *******************************************************************************************/
  public void addLabel( String label, Font font, FontRenderContext fontRenderContext )
  {
    TextTag textTag= new TextTag( label, font, fontRenderContext );
    this.textTags.add( textTag );

    this.widestLabel = Math.max( textTag.getWidth(), this.widestLabel );
    this.totalLabelWidths += textTag.getWidth();

    this.tallestLabel = Math.max( textTag.getHeight(), this.tallestLabel );
  }
View Full Code Here

   * @param axisValueRenderEvent
   ***********************************************************************************/
  public void postRender( AxisValueRenderEvent axisValueRenderEvent )
  {
    AxisChart axisChart = (AxisChart) axisValueRenderEvent.getSource();
    TextTag valueTag;
    float x;
    float y;


    if( axisValueRenderEvent.getiAxisPlotDataSet() instanceof IAxisChartDataSet )
    {
      IAxisChartDataSet iAxisChartDataSet = (IAxisChartDataSet) axisValueRenderEvent.getiAxisPlotDataSet();
      double value = iAxisChartDataSet.getValue( axisValueRenderEvent.getDataSetIndex(), axisValueRenderEvent.getValueIndex() );

      valueTag = new TextTag( this.numberFormat.format( value ),
                      this.valueChartFont.getFont(),
                      this.derivedFont,
                      axisValueRenderEvent.getFontRenderContext() );

      if( axisChart.getAxisProperties().isPlotHorizontal() )
      {
        x = this.calculateXHorizontalPlot( axisValueRenderEvent, valueTag, (value < 0) );
        y = this.calculateYHorizontalPlot( axisValueRenderEvent, valueTag );
      }
      else
      {
        x = this.calculateXVerticalPlot( axisValueRenderEvent, valueTag );
        y = this.calculateYVerticalPlot( axisValueRenderEvent, valueTag, (value < 0) );
      }
    }
    else
    {
//todo scatter and hi/low
      valueTag = null;
      x = 100;
      y = 100;

      throw new RuntimeException( "Axis Values not yet implemented for this type of chart." );
    }


/*
    Line2D.Float line= new Line2D.Float( x, y, x, y -20 );
    axisValueRenderEvent.getGraphics2D().draw( line );
*/

    valueTag.setXPosition( x );
    valueTag.setYPosition( y );
    valueTag.render( axisValueRenderEvent.getGraphics2D(), this.valueChartFont.getPaint() );
  }
View Full Code Here

TOP

Related Classes of org.krysalis.jcharts.chartText.TextTag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.