whitespace COMPANY whitespace SERVICES whitespace PRODUCTS whitespace PURCHASE whitespace SUPPORT whitespace CONTACTS whitespace Home whitespace Contact Us whitespace Site Map whitespace
whitespace
SUPPORT
whitespace
FORUM
whitespace
FAQS
whitespace
SUBSCRIPTION
whitespace
REQUEST ON-LINE
whitespace
whitespace

Technical Support Forum

Welcome Guest Search | Active Topics | Log In | Register

Hit dosn`t work for CandleStick type Options · View
sionus
#1 Posted : Friday, October 15, 2010 4:51:05 PM
Rank: Newbie

Groups: Registered

Joined: 10/13/2010
Posts: 5
Please try following sample
Code:


import java.util.List;

import com.artfulbits.aiCharts.ChartView;
import com.artfulbits.aiCharts.Base.ChartArea;
import com.artfulbits.aiCharts.Base.ChartPoint;
import com.artfulbits.aiCharts.Base.ChartSeries;
import com.artfulbits.aiCharts.Types.ChartCandleStickType;
import com.artfulbits.aiCharts.Types.ChartTypes;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Toast;

public class Main extends Activity implements OnTouchListener{


    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       
        ChartView chartView = new ChartView(this);
        chartView.setHitTestEnabled(true);
        ChartSeries series1 = new ChartSeries("Candle", ChartTypes.CandleStick);
        series1.setAttribute(ChartCandleStickType.PRICE_DOWN_COLOR, Color.GREEN);
        series1.setAttribute(ChartCandleStickType.PRICE_UP_COLOR, Color.WHITE);
        series1.setAttribute(ChartCandleStickType.POINT_WIDTH, 0.1f);
        ChartSeries series2 = new ChartSeries("Point", ChartTypes.Point);
        chartView.getAreas().add(new ChartArea());
        chartView.getSeries().add(series1);
        chartView.getSeries().add(series2);
       
        for(int i = 0; i < 10; i++)
        {
            series1.getPoints().addXY(i, i+2, i-2, i+1, i-1);
            series2.getPoints().addXY(i, 10-i);
        }
        chartView.setOnTouchListener(this);
       
        setContentView(chartView);
    }

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        ChartView chartView = (ChartView)v;
        int x = (int)event.getX() - chartView.getLeft();
        int y = (int)event.getY() - chartView.getTop();
       
        if(event.getAction() == MotionEvent.ACTION_DOWN)
        {
           
            List<Object> res = chartView.getChart().hitTest(x,y);
            for (Object object : res)
            {
                if(object instanceof ChartPoint)
                {
                    ChartPoint p = (ChartPoint)object;
                    Toast.makeText(this,
                            p.getSeries().getType().toString(),
                            Toast.LENGTH_SHORT).show();
                    return true;
                }else{
                }
            }
        }
        return false;
    }
}
Baydalka Volodymyr
#2 Posted : Friday, October 15, 2010 6:32:08 PM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

That is a known issue.
Hit testing is not supported for financial chart types yet (Candle-Stick, HiLo, HiLoOpenClose).

Consider requesting this functionality if you have active subscribtion.

Best regards,
Volodymyr Baydalka
Andriod development and support team
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2016 ArtfulBits. All rights reserved.