Package org.krysalis.jcharts.properties

Examples of org.krysalis.jcharts.properties.StockChartProperties


    double[] highs=TestDataGenerator.getRandomNumbers( dataSize, 500, 1000 );
    double[] lows=TestDataGenerator.getRandomNumbers( dataSize, 100, 300 );
    double[] opens=TestDataGenerator.getRandomNumbers( dataSize, 350, 450 );
    double[] closes=TestDataGenerator.getRandomNumbers( dataSize, 350, 450 );

    StockChartProperties stockChartProperties=new StockChartProperties();

    StockChartDataSet stockChartDataSet=new StockChartDataSet( highs, "High", lows, "Low", Color.black, stockChartProperties );
    stockChartDataSet.setOpenValues( opens, "Open", Color.red );
    stockChartDataSet.setCloseValues( closes, "Close", Color.green );
View Full Code Here


    double[] highs= TestDataGenerator.getRandomNumbers( dataSize, 500, 1000 );
    double[] lows= TestDataGenerator.getRandomNumbers( dataSize, 100, 300 );
    double[] opens= TestDataGenerator.getRandomNumbers( dataSize, 350, 450 );
    double[] closes= TestDataGenerator.getRandomNumbers( dataSize, 350, 450 );

      StockChartProperties stockChartProperties= new StockChartProperties();

    stockChartDataSet= new StockChartDataSet( highs, "High", lows, "Low", Color.black, stockChartProperties );
    stockChartDataSet.setOpenValues( opens, "Open", Color.red );
    stockChartDataSet.setCloseValues( closes, "Close", Color.green );
View Full Code Here

    double[] highs= TestDataGenerator.getRandomNumbers( dataSize, 500, 1000 );
    double[] lows= TestDataGenerator.getRandomNumbers( dataSize, 100, 300 );
    double[] opens= TestDataGenerator.getRandomNumbers( dataSize, 350, 450 );
    double[] closes= TestDataGenerator.getRandomNumbers( dataSize, 350, 450 );

      StockChartProperties stockChartProperties= new StockChartProperties();
    stockChartProperties.setHiLowStroke( new BasicStroke( 3.0f ) );
    stockChartProperties.setCloseStroke( new BasicStroke( 2.5f ) );

    stockChartDataSet= new StockChartDataSet( highs, "High", lows, "Low", Color.black, stockChartProperties );
    stockChartDataSet.setOpenValues( opens, "Open", Color.red );
    stockChartDataSet.setCloseValues( closes, "Close", Color.green );
View Full Code Here

    double[] highs= TestDataGenerator.getRandomNumbers( dataSize, 500, 1000 );
    double[] lows= TestDataGenerator.getRandomNumbers( dataSize, 100, 300 );
    double[] opens= TestDataGenerator.getRandomNumbers( dataSize, 350, 450 );
    double[] closes= TestDataGenerator.getRandomNumbers( dataSize, 350, 450 );

      StockChartProperties stockChartProperties= new StockChartProperties();
    stockChartProperties.setOpenPixelLength( 10 );
    stockChartProperties.setClosePixelLength( 20 );

    stockChartDataSet= new StockChartDataSet( highs, "High", lows, "Low", Color.black, stockChartProperties );
    stockChartDataSet.setOpenValues( opens, "Open", Color.red );
    stockChartDataSet.setCloseValues( closes, "Close", Color.green );
View Full Code Here

   * @param axisChart
   * @param iStockChartDataSet
   *********************************************************************************************/
  static final void render( AxisChart axisChart, IStockChartDataSet iStockChartDataSet )
  {
    StockChartProperties stockChartProperties=(StockChartProperties) iStockChartDataSet.getChartTypeProperties();
    Graphics2D g2d=axisChart.getGraphics2D();

    DataAxisProperties dataAxisProperties= (DataAxisProperties) axisChart.getAxisProperties().getYAxisProperties();
      IDataSeries iDataSeries= (IDataSeries) axisChart.getIAxisDataSeries();


    //---cache the computed values
    //float[][] yAxisCoordinates=new float[ iStockChartDataSet.getNumberOfDataSets() ][ iStockChartDataSet.getNumberOfDataItems() ];


    //---init for first segment
    Line2D.Float line=new Line2D.Float( axisChart.getXAxis().getTickStart(),
                            0,
                            axisChart.getXAxis().getTickStart(),
                            0 );


    Line2D.Float openLine=null;
    if( iStockChartDataSet.hasOpenValues() )
    {
      openLine=new Line2D.Float( axisChart.getXAxis().getTickStart() - stockChartProperties.getOpenPixelLength() - 1,
                        0,
                        axisChart.getXAxis().getTickStart() - 1,
                        0 );
    }


    Line2D.Float closeLine=null;
    if( iStockChartDataSet.hasCloseValues() )
    {
      closeLine=new Line2D.Float( axisChart.getXAxis().getTickStart() + 1,
                         0,
                         axisChart.getXAxis().getTickStart() + stockChartProperties.getClosePixelLength() + 1,
                         0 );
    }


    //LOOP
    //---draw each line to the image
    for( int i=0; i < iStockChartDataSet.getNumberOfDataItems(); i++ )
    {
      line.y1= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
                                          iStockChartDataSet.getLowValue( i ),
                                          axisChart.getYAxis().getScaleCalculator().getMinValue() );
      line.y2= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
                                          iStockChartDataSet.getHighValue( i ),
                                          axisChart.getYAxis().getScaleCalculator().getMinValue() );

      String label;
      if( axisChart.getXAxis().getAxisLabelsGroup() != null )
      {
        label = axisChart.getXAxis().getAxisLabelsGroup().getTextTag( i ).getText();
      }
      else
      {
        label = null;
      }

      //---if we are generating an ImageMap, store the image coordinates
      if( axisChart.getGenerateImageMapFlag() )
      {
        axisChart.getImageMap().addImageMapArea( new CircleMapArea( line.x1,
                                                line.y1,
                                                iStockChartDataSet.getLowValue( i ),
                                                label,
                                                iStockChartDataSet.getLegendLabel( StockChartDataType.LOW.getInt() ) ) );

        axisChart.getImageMap().addImageMapArea( new CircleMapArea( line.x2,
                                                line.y2,
                                                iStockChartDataSet.getHighValue( i ),
                                                label,
                                                iStockChartDataSet.getLegendLabel( StockChartDataType.HIGH.getInt() ) ) );
      }

      g2d.setPaint( iStockChartDataSet.getPaint( StockChartDataType.HIGH.getInt() ) );
      g2d.setStroke( stockChartProperties.getHiLowStroke() );
      g2d.draw( line );

      line.x1+=axisChart.getXAxis().getScalePixelWidth();
      line.x2=line.x1;

      if( openLine != null )
      {
        if( iStockChartDataSet.getOpenValue( i ) != Double.NaN )
        {
          openLine.y1= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
                                                iStockChartDataSet.getOpenValue( i ),
                                                axisChart.getYAxis().getScaleCalculator().getMinValue() );
          openLine.y2=openLine.y1;

          g2d.setPaint( iStockChartDataSet.getPaint( StockChartDataType.OPEN.getInt() ) );
          g2d.setStroke( stockChartProperties.getOpenStroke() );
          g2d.draw( openLine );

          //---if we are generating an ImageMap, store the image coordinates
          if( axisChart.getGenerateImageMapFlag() )
          {
            axisChart.getImageMap().addImageMapArea( new CircleMapArea( openLine.x1,
                                                    openLine.y1,
                                                    iStockChartDataSet.getOpenValue( i ),
                                                    label,
                                                    iStockChartDataSet.getLegendLabel( StockChartDataType.OPEN.getInt() ) ) );
          }

          openLine.x1+=axisChart.getXAxis().getScalePixelWidth();
          openLine.x2+=axisChart.getXAxis().getScalePixelWidth();
        }
      }

      if( closeLine != null )
      {
        if( iStockChartDataSet.getOpenValue( i ) != Double.NaN )
        {
          closeLine.y1= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
                                                 iStockChartDataSet.getCloseValue( i ),
                                                 axisChart.getYAxis().getScaleCalculator().getMinValue() );
          closeLine.y2=closeLine.y1;

          g2d.setPaint( iStockChartDataSet.getPaint( StockChartDataType.CLOSE.getInt() ) );
          g2d.setStroke( stockChartProperties.getCloseStroke() );
          g2d.draw( closeLine );

          //---if we are generating an ImageMap, store the image coordinates
          if( axisChart.getGenerateImageMapFlag() )
          {
View Full Code Here

   * Separate this so can use for combo chart test
   *
   ******************************************************************************************/
  static ChartTypeProperties getChartTypeProperties( int numberOfDataSets )
  {
    StockChartProperties stockChartProperties=new StockChartProperties();
    return stockChartProperties;
  }
View Full Code Here

    double[] highs=TestDataGenerator.getRandomNumbers( dataSize, 500, 1000 );
    double[] lows=TestDataGenerator.getRandomNumbers( dataSize, 100, 300 );
    double[] opens=TestDataGenerator.getRandomNumbers( dataSize, 350, 450 );
    double[] closes=TestDataGenerator.getRandomNumbers( dataSize, 350, 450 );

    StockChartProperties stockChartProperties=new StockChartProperties();

    stockChartDataSet=new StockChartDataSet( highs, "High", lows, "Low", Color.black, stockChartProperties );
    stockChartDataSet.setOpenValues( opens, "Open", Color.red );
    stockChartDataSet.setCloseValues( closes, "Close", Color.green );
View Full Code Here

   * @param axisChart
   * @param iStockChartDataSet
   *********************************************************************************************/
  static final void render( AxisChart axisChart, IStockChartDataSet iStockChartDataSet )
  {
    StockChartProperties stockChartProperties=(StockChartProperties) iStockChartDataSet.getChartTypeProperties();
    Graphics2D g2d=axisChart.getGraphics2D();

    DataAxisProperties dataAxisProperties= (DataAxisProperties) axisChart.getAxisProperties().getYAxisProperties();
      IDataSeries iDataSeries= (IDataSeries) axisChart.getIAxisDataSeries();


    //---cache the computed values
    //float[][] yAxisCoordinates=new float[ iStockChartDataSet.getNumberOfDataSets() ][ iStockChartDataSet.getNumberOfDataItems() ];


    //---init for first segment
    Line2D.Float line=new Line2D.Float( axisChart.getXAxis().getTickStart(),
                            0,
                            axisChart.getXAxis().getTickStart(),
                            0 );


    Line2D.Float openLine=null;
    if( iStockChartDataSet.hasOpenValues() )
    {
      openLine=new Line2D.Float( axisChart.getXAxis().getTickStart() - stockChartProperties.getOpenPixelLength() - 1,
                        0,
                        axisChart.getXAxis().getTickStart() - 1,
                        0 );
    }


    Line2D.Float closeLine=null;
    if( iStockChartDataSet.hasCloseValues() )
    {
      closeLine=new Line2D.Float( axisChart.getXAxis().getTickStart() + 1,
                         0,
                         axisChart.getXAxis().getTickStart() + stockChartProperties.getClosePixelLength() + 1,
                         0 );
    }


    //LOOP
    //---draw each line to the image
    for( int i=0; i < iStockChartDataSet.getNumberOfDataItems(); i++ )
    {
      line.y1= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
                                          iStockChartDataSet.getLowValue( i ),
                                          axisChart.getYAxis().getScaleCalculator().getMinValue() );
      line.y2= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
                                          iStockChartDataSet.getHighValue( i ),
                                          axisChart.getYAxis().getScaleCalculator().getMinValue() );

      String label;
      if( axisChart.getXAxis().getAxisLabelsGroup() != null )
      {
        label = axisChart.getXAxis().getAxisLabelsGroup().getTextTag( i ).getText();
      }
      else
      {
        label = null;
      }

      //---if we are generating an ImageMap, store the image coordinates
      if( axisChart.getGenerateImageMapFlag() )
      {
        axisChart.getImageMap().addImageMapArea( new CircleMapArea( line.x1,
                                                line.y1,
                                                iStockChartDataSet.getLowValue( i ),
                                                label,
                                                iStockChartDataSet.getLegendLabel( StockChartDataType.LOW.getInt() ) ) );

        axisChart.getImageMap().addImageMapArea( new CircleMapArea( line.x2,
                                                line.y2,
                                                iStockChartDataSet.getHighValue( i ),
                                                label,
                                                iStockChartDataSet.getLegendLabel( StockChartDataType.HIGH.getInt() ) ) );
      }

      g2d.setPaint( iStockChartDataSet.getPaint( StockChartDataType.HIGH.getInt() ) );
      g2d.setStroke( stockChartProperties.getHiLowStroke() );
      g2d.draw( line );

      line.x1+=axisChart.getXAxis().getScalePixelWidth();
      line.x2=line.x1;

      if( openLine != null )
      {
        if( iStockChartDataSet.getOpenValue( i ) != Double.NaN )
        {
          openLine.y1= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
                                                iStockChartDataSet.getOpenValue( i ),
                                                axisChart.getYAxis().getScaleCalculator().getMinValue() );
          openLine.y2=openLine.y1;

          g2d.setPaint( iStockChartDataSet.getPaint( StockChartDataType.OPEN.getInt() ) );
          g2d.setStroke( stockChartProperties.getOpenStroke() );
          g2d.draw( openLine );

          //---if we are generating an ImageMap, store the image coordinates
          if( axisChart.getGenerateImageMapFlag() )
          {
            axisChart.getImageMap().addImageMapArea( new CircleMapArea( openLine.x1,
                                                    openLine.y1,
                                                    iStockChartDataSet.getOpenValue( i ),
                                                    label,
                                                    iStockChartDataSet.getLegendLabel( StockChartDataType.OPEN.getInt() ) ) );
          }

          openLine.x1+=axisChart.getXAxis().getScalePixelWidth();
          openLine.x2+=axisChart.getXAxis().getScalePixelWidth();
        }
      }

      if( closeLine != null )
      {
        if( iStockChartDataSet.getOpenValue( i ) != Double.NaN )
        {
          closeLine.y1= axisChart.getYAxis().computeAxisCoordinate( axisChart.getYAxis().getOrigin(),
                                                 iStockChartDataSet.getCloseValue( i ),
                                                 axisChart.getYAxis().getScaleCalculator().getMinValue() );
          closeLine.y2=closeLine.y1;

          g2d.setPaint( iStockChartDataSet.getPaint( StockChartDataType.CLOSE.getInt() ) );
          g2d.setStroke( stockChartProperties.getCloseStroke() );
          g2d.draw( closeLine );

          //---if we are generating an ImageMap, store the image coordinates
          if( axisChart.getGenerateImageMapFlag() )
          {
View Full Code Here

    double[] highs=TestDataGenerator.getRandomNumbers( dataSize, 500, 1000 );
    double[] lows=TestDataGenerator.getRandomNumbers( dataSize, 100, 300 );
    double[] opens=TestDataGenerator.getRandomNumbers( dataSize, 350, 450 );
    double[] closes=TestDataGenerator.getRandomNumbers( dataSize, 350, 450 );

    StockChartProperties stockChartProperties=new StockChartProperties();

    StockChartDataSet stockChartDataSet=new StockChartDataSet( highs, "High", lows, "Low", Color.black, stockChartProperties );
    stockChartDataSet.setOpenValues( opens, "Open", Color.red );
    stockChartDataSet.setCloseValues( closes, "Close", Color.green );
View Full Code Here

   * Separate this so can use for combo chart test
   *
   ******************************************************************************************/
  static ChartTypeProperties getChartTypeProperties( int numberOfDataSets )
  {
    StockChartProperties stockChartProperties=new StockChartProperties();
    return stockChartProperties;
  }
View Full Code Here

TOP

Related Classes of org.krysalis.jcharts.properties.StockChartProperties

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.