本文整理汇总了Java中org.achartengine.model.SeriesSelection类的典型用法代码示例。如果您正苦于以下问题:Java SeriesSelection类的具体用法?Java SeriesSelection怎么用?Java SeriesSelection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SeriesSelection类属于org.achartengine.model包,在下文中一共展示了SeriesSelection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSeriesAndPointForScreenCoordinate
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
public SeriesSelection getSeriesAndPointForScreenCoordinate(final Point screenPoint) {
if (clickableAreas != null)
for (int seriesIndex = clickableAreas.size() - 1; seriesIndex >= 0; seriesIndex--) {
// series 0 is drawn first. Then series 1 is drawn on top, and series 2
// on top of that.
// we want to know what the user clicked on, so traverse them in the
// order they appear on the screen.
int pointIndex = 0;
if (clickableAreas.get(seriesIndex) != null) {
RectF rectangle;
for (ClickableArea area : clickableAreas.get(seriesIndex)) {
if (area != null) {
rectangle = area.getRect();
if (rectangle != null && rectangle.contains(screenPoint.getX(), screenPoint.getY())) {
return new SeriesSelection(seriesIndex, pointIndex, area.getX(), area.getY());
}
}
pointIndex++;
}
}
}
return super.getSeriesAndPointForScreenCoordinate(screenPoint);
}
示例2: getSeriesAndPointForScreenCoordinate
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
public SeriesSelection getSeriesAndPointForScreenCoordinate(Point point)
{
label0:
{
if (!isOnPieChart(point))
{
break label0;
}
double d1 = getAngle(point);
Iterator iterator = a.iterator();
PieSegment piesegment;
do
{
if (!iterator.hasNext())
{
break label0;
}
piesegment = (PieSegment)iterator.next();
} while (!piesegment.isInSegment(d1));
return new SeriesSelection(0, piesegment.getDataIndex(), piesegment.getValue(), piesegment.getValue());
}
return null;
}
示例3: getSeriesAndPointForScreenCoordinate
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
public SeriesSelection getSeriesAndPointForScreenCoordinate(final Point screenPoint) {
if (clickableAreas != null)
for (int seriesIndex = clickableAreas.size() - 1; seriesIndex >= 0; seriesIndex--) {
// series 0 is drawn first. Then series 1 is drawn on top, and series 2
// on top of that.
// we want to know what the user clicked on, so traverse them in the
// order they appear on the screen.
int pointIndex = 0;
if (clickableAreas.get(seriesIndex) != null) {
RectF rectangle;
for (ClickableArea area : clickableAreas.get(seriesIndex)) {
rectangle = area.getRect();
if (rectangle != null && rectangle.contains(screenPoint.getX(), screenPoint.getY())) {
return new SeriesSelection(seriesIndex, pointIndex, area.getX(), area.getY());
}
pointIndex++;
}
}
}
return super.getSeriesAndPointForScreenCoordinate(screenPoint);
}
示例4: setupChartListeners
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
private void setupChartListeners(){
//mChartView = ChartFactory.getLineChartView(this, line.getMultiDataSet(), line.getMultiRenderer());
line.getMultiRenderer().setClickEnabled(true);
line.getMultiRenderer().setSelectableBuffer(15);
mChartView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
if (seriesSelection == null) {
}else{
String val = Double.toString(round(seriesSelection.getValue()));
if(seriesSelection.getSeriesIndex()==0){
subTitleData1.setText(val);
Toast.makeText(SingleChartActivity.this, chartType+val, Toast.LENGTH_SHORT).show();
}
if(seriesSelection.getSeriesIndex()==1){
subTitleData2.setText(val);
Toast.makeText(SingleChartActivity.this, "Volts: "+val, Toast.LENGTH_SHORT).show();
}
}
}
});
}
示例5: setupChartListeners
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
private void setupChartListeners(){
line.getMultiRenderer().setClickEnabled(true);
line.getMultiRenderer().setSelectableBuffer(15);
mChartView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
if (seriesSelection == null) {
}else{
String val = Double.toString(round(seriesSelection.getValue()));
if(seriesSelection.getSeriesIndex()==0){
Toast.makeText(DualChartActivity.this, chartTypeOne+val, Toast.LENGTH_SHORT).show();
}
if(seriesSelection.getSeriesIndex()==1){
Toast.makeText(DualChartActivity.this, chartTypeTwo+val, Toast.LENGTH_SHORT).show();
}
if(seriesSelection.getSeriesIndex()==2){
Toast.makeText(DualChartActivity.this, "Volts: "+val, Toast.LENGTH_SHORT).show();
}
}
}
});
}
示例6: getSeriesAndPointForScreenCoordinate
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
/**
* Fetches the SeriesSelection for the PieSegment selected.
*
* @param screenPoint - the user tap location
* @return null if screen point is not in PieChart or its config if it is
*/
public SeriesSelection getSeriesAndPointForScreenCoordinate(Point screenPoint) {
if (isOnPieChart(screenPoint)) {
double angleFromPieCenter = getAngle(screenPoint);
for (PieSegment pieSeg : mPieSegmentList) {
if (pieSeg.isInSegment(angleFromPieCenter)) {
return new SeriesSelection(0, pieSeg.getDataIndex(), pieSeg.getValue(),
pieSeg.getValue());
}
}
}
return null;
}
示例7: onResume
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (mChartView == null) {
LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
mChartView = ChartFactory.getPieChartView(this, mSeries, mRenderer);
mRenderer.setClickEnabled(true);
mChartView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
if (seriesSelection == null) {
Toast.makeText(PieChartBuilder.this, "No chart element selected", Toast.LENGTH_SHORT)
.show();
} else {
for (int i = 0; i < mSeries.getItemCount(); i++) {
mRenderer.getSeriesRendererAt(i).setHighlighted(i == seriesSelection.getPointIndex());
}
mChartView.repaint();
Toast.makeText(
PieChartBuilder.this,
"Chart data point index " + seriesSelection.getPointIndex() + " selected"
+ " point value=" + seriesSelection.getValue(), Toast.LENGTH_SHORT).show();
}
}
});
layout.addView(mChartView, new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
} else {
mChartView.repaint();
}
}
示例8: onResume
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (mChartView == null) {
LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
mChartView = ChartFactory.getLineChartView(this, mDataset, mRenderer);
// enable the chart click events
mRenderer.setClickEnabled(true);
mRenderer.setSelectableBuffer(10);
mChartView.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// handle the click event on the chart
SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
if (seriesSelection == null) {
Toast.makeText(XYChartBuilder.this, "No chart element", Toast.LENGTH_SHORT).show();
} else {
// display information of the clicked point
Toast.makeText(
XYChartBuilder.this,
"Chart element in series index " + seriesSelection.getSeriesIndex()
+ " data point index " + seriesSelection.getPointIndex() + " was clicked"
+ " closest point value X=" + seriesSelection.getXValue() + ", Y="
+ seriesSelection.getValue(), Toast.LENGTH_SHORT).show();
}
}
});
layout.addView(mChartView, new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
boolean enabled = mDataset.getSeriesCount() > 0;
setSeriesWidgetsEnabled(enabled);
} else {
mChartView.repaint();
}
}
示例9: getSeriesAndPointForScreenCoordinate
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
public SeriesSelection getSeriesAndPointForScreenCoordinate(Point point)
{
if (f != null)
{
for (int i = -1 + f.size(); i >= 0; i--)
{
int j = 0;
if (f.get(Integer.valueOf(i)) == null)
{
continue;
}
for (Iterator iterator = ((List)f.get(Integer.valueOf(i))).iterator(); iterator.hasNext(); j++)
{
ClickableArea clickablearea = (ClickableArea)iterator.next();
if (clickablearea == null)
{
continue;
}
RectF rectf = clickablearea.getRect();
if (rectf != null && rectf.contains(point.getX(), point.getY()))
{
return new SeriesSelection(i, j, clickablearea.getX(), clickablearea.getY());
}
}
}
}
return super.getSeriesAndPointForScreenCoordinate(point);
}
示例10: setupChartListeners
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
private void setupChartListeners(){
line.getMultiRenderer().setClickEnabled(true);
line.getMultiRenderer().setSelectableBuffer(15);
mChartView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
if (seriesSelection == null) {
}else{
String val = Double.toString(round(seriesSelection.getValue()));
if(seriesSelection.getSeriesIndex()==0){
subTitleData1.setText(Double.toString(round(seriesSelection.getValue())));
Toast.makeText(QuadChartActivity.this, "Boost: "+val, Toast.LENGTH_SHORT).show();
}
if(seriesSelection.getSeriesIndex()==1){
subTitleData2.setText(Double.toString(round(seriesSelection.getValue())));
Toast.makeText(QuadChartActivity.this, "Wideband: "+val, Toast.LENGTH_SHORT).show();
}
if(seriesSelection.getSeriesIndex()==2){
subTitleData3.setText(Double.toString(round(seriesSelection.getValue())));
Toast.makeText(QuadChartActivity.this, "Temp: "+val, Toast.LENGTH_SHORT).show();
}
if(seriesSelection.getSeriesIndex()==3){
subTitleData4.setText(Double.toString(round(seriesSelection.getValue())));
Toast.makeText(QuadChartActivity.this, "Oil: "+val, Toast.LENGTH_SHORT).show();
}
if(seriesSelection.getSeriesIndex()==4){
subTitleData5.setText(Double.toString(round(seriesSelection.getValue())));
Toast.makeText(QuadChartActivity.this, "Volts: "+val, Toast.LENGTH_SHORT).show();
}
}
}
});
}
示例11: getSeriesAndPointForScreenCoordinate
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
public SeriesSelection getSeriesAndPointForScreenCoordinate(Point screenPoint) {
return mPieMapper.getSeriesAndPointForScreenCoordinate(screenPoint);
}
示例12: onResume
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (mChartView == null) {
LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
// mChartView = ChartFactory.getLineChartView(this, mDataset, mRenderer);
// mChartView = ChartFactory.getBarChartView(this, mDataset, mRenderer,
// Type.DEFAULT);
mChartView = ChartFactory.getScatterChartView(this, mDataset, mRenderer);
// enable the chart click events
mRenderer.setClickEnabled(true);
mRenderer.setSelectableBuffer(100);
mChartView.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// handle the click event on the chart
SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
if (seriesSelection == null) {
Toast.makeText(XYChartBuilderBackup.this, "No chart element was clicked",
Toast.LENGTH_SHORT).show();
} else {
// display information of the clicked point
double[] xy = mChartView.toRealPoint(0);
Toast.makeText(
XYChartBuilderBackup.this,
"Chart element in series index " + seriesSelection.getSeriesIndex()
+ " data point index " + seriesSelection.getPointIndex() + " was clicked"
+ " closest point value X=" + seriesSelection.getXValue() + ", Y="
+ seriesSelection.getValue() + " clicked point value X=" + (float) xy[0]
+ ", Y=" + (float) xy[1], Toast.LENGTH_SHORT).show();
}
}
});
// an example of handling the zoom events on the chart
mChartView.addZoomListener(new ZoomListener() {
public void zoomApplied(ZoomEvent e) {
String type = "out";
if (e.isZoomIn()) {
type = "in";
}
Log.i("Zoom", "Zoom " + type + " rate " + e.getZoomRate());
}
public void zoomReset() {
Log.i("Zoom", "Reset");
}
}, true, true);
// an example of handling the pan events on the chart
mChartView.addPanListener(new PanListener() {
public void panApplied() {
Log.i("Pan", "New X range=[" + mRenderer.getXAxisMin() + ", " + mRenderer.getXAxisMax()
+ "], Y range=[" + mRenderer.getYAxisMax() + ", " + mRenderer.getYAxisMax() + "]");
}
});
layout.addView(mChartView, new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
boolean enabled = mDataset.getSeriesCount() > 0;
setSeriesWidgetsEnabled(enabled);
} else {
mChartView.repaint();
}
}
示例13: onCreateView
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_report, container, false);
Calendar cal = Calendar.getInstance();
Date now = new Date();
cal.setTime(now);
currentTimeStamp = cal.getTimeInMillis();
ButterKnife.bind(this, view);
mChartView = reportGraph.getChartGraph(getActivity());
mChartView.addZoomListener(new ZoomListener() {
public void zoomApplied(ZoomEvent e) {
updateLabels();
}
public void zoomReset() {
}
}, true, true);
mChartView.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// handle the click event on the chart
SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
if (seriesSelection == null) {
//Toast.makeText(getActivity(), "No chart element", Toast.LENGTH_SHORT).show();
} else if(workoutType == WorkoutTypes.STEP_COUNT.getValue()){
// display information of the clicked point
Toast.makeText(
getActivity(),
"" + reportGraph.getDataAtPoint(seriesSelection.getXValue()) + " steps", Toast.LENGTH_SHORT).show();
}
}
});
mChartView.addPanListener(new PanListener() {
@Override
public void panApplied() {
updateLabels();
}
});
mChartLayout.addView(mChartView);
// Now return the SwipeRefreshLayout as this fragment's content view
return view;
}
示例14: lineChartView
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
private void lineChartView() {
TypedValue outValue1 = new TypedValue();
TypedValue outValue2 = new TypedValue();
TypedValue outValue3 = new TypedValue();
TypedValue outValue4 = new TypedValue();
mContext.getResources().getValue(R.dimen.line_axis_title_text_size_value, outValue1, true);
mContext.getResources().getValue(R.dimen.line_chart_title_text_size_value, outValue2, true);
mContext.getResources().getValue(R.dimen.line_labels_text_size_value, outValue3, true);
mContext.getResources().getValue(R.dimen.line_legend_text_size_value, outValue4, true);
float lineAxisTitleTextSizeValue = outValue1.getFloat();
float lineCharTitleTextSizeValue = outValue2.getFloat();
float lineLabelsTextSizeValue = outValue3.getFloat();
float lineLegendTextSizeValue = outValue4.getFloat();
XYMultipleSeriesDataset mDataset = getDataset();
XYMultipleSeriesRenderer mRenderer = getRenderer();
mRenderer.setApplyBackgroundColor(true);
mRenderer.setBackgroundColor(Color.TRANSPARENT);
mRenderer.setMarginsColor(Color.argb(0x00, 0x01, 0x01, 0x01));
mRenderer.setAxisTitleTextSize(lineAxisTitleTextSizeValue);
mRenderer.setChartTitleTextSize(lineCharTitleTextSizeValue);
mRenderer.setLabelsTextSize(lineLabelsTextSizeValue);
mRenderer.setLegendTextSize(lineLegendTextSizeValue);
mRenderer.setMargins(new int[] { 12, 25, 12, 12 });
mRenderer.setZoomButtonsVisible(true);
mRenderer.setPointSize(10);
mRenderer.setClickEnabled(true);
mChartView = ChartFactory.getLineChartView(getActivity(), mDataset, mRenderer);
mChartView.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
if (seriesSelection != null) {
UIFunctionUtils.showMessage(mContext, true, (int) seriesSelection.getValue() + " "
+ getString(R.string.beats_per_minute));
}
}
});
layout.addView(mChartView);
}
示例15: lineChartView_type1
import org.achartengine.model.SeriesSelection; //导入依赖的package包/类
private void lineChartView_type1() {
if (paintChartView) {
check1.setVisibility(View.VISIBLE);
check2.setVisibility(View.VISIBLE);
txt1.setVisibility(View.GONE);
TypedValue outValue1 = new TypedValue();
TypedValue outValue2 = new TypedValue();
TypedValue outValue3 = new TypedValue();
TypedValue outValue4 = new TypedValue();
mContext.getResources().getValue(R.dimen.line_axis_title_text_size_value, outValue1, true);
mContext.getResources().getValue(R.dimen.line_chart_title_text_size_value, outValue2, true);
mContext.getResources().getValue(R.dimen.line_labels_text_size_value, outValue3, true);
mContext.getResources().getValue(R.dimen.line_legend_text_size_value, outValue4, true);
float lineAxisTitleTextSizeValue = outValue1.getFloat();
float lineCharTitleTextSizeValue = outValue2.getFloat();
float lineLabelsTextSizeValue = outValue3.getFloat();
float lineLegendTextSizeValue = outValue4.getFloat();
XYMultipleSeriesDataset mDataset = getDataset_type1();
XYMultipleSeriesRenderer mRenderer = getRenderer_type1();
mRenderer.setApplyBackgroundColor(true);
mRenderer.setBackgroundColor(Color.TRANSPARENT);
mRenderer.setMarginsColor(Color.argb(0x00, 0x01, 0x01, 0x01));
mRenderer.setAxisTitleTextSize(lineAxisTitleTextSizeValue);
mRenderer.setChartTitleTextSize(lineCharTitleTextSizeValue);
mRenderer.setLabelsTextSize(lineLabelsTextSizeValue);
mRenderer.setLegendTextSize(lineLegendTextSizeValue);
mRenderer.setMargins(new int[] { 12, 25, 12, 22 });
mRenderer.setZoomButtonsVisible(true);
mRenderer.setPointSize(10);
mRenderer.setClickEnabled(true);
mChartView = ChartFactory.getLineChartView(getActivity(), mDataset, mRenderer);
mChartView.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
if (seriesSelection != null) {
String units = "";
switch (seriesSelection.getSeriesIndex()) {
case 0:
units = " "
+ (isMetric ? getString(R.string.long_unit1_detail_4)
: getString(R.string.long_unit2_detail_4));
break;
case 1:
units = " "
+ (isMetric ? getString(R.string.long_unit1_detail_2)
: getString(R.string.long_unit2_detail_2));
break;
}
UIFunctionUtils.showMessage(mContext, true, (int) seriesSelection.getValue() + units);
}
}
});
chartLayout.addView(mChartView);
} else {
setCorrectText();
}
}