本文整理匯總了Java中org.achartengine.renderer.XYMultipleSeriesRenderer.setClickEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java XYMultipleSeriesRenderer.setClickEnabled方法的具體用法?Java XYMultipleSeriesRenderer.setClickEnabled怎麽用?Java XYMultipleSeriesRenderer.setClickEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.achartengine.renderer.XYMultipleSeriesRenderer
的用法示例。
在下文中一共展示了XYMultipleSeriesRenderer.setClickEnabled方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUpRenderer
import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的package包/類
/**
* Set up a {@link XYMultipleSeriesRenderer} with the specs customized per plot tab.
*/
private void setUpRenderer(XYMultipleSeriesRenderer renderer, int tabNumber) {
renderer.setXAxisMin(0);
renderer.setXAxisMax(60);
renderer.setYAxisMin(RENDER_HEIGHTS[tabNumber][0]);
renderer.setYAxisMax(RENDER_HEIGHTS[tabNumber][1]);
renderer.setYAxisAlign(Align.RIGHT, 0);
renderer.setLegendTextSize(30);
renderer.setLabelsTextSize(30);
renderer.setYLabelsColor(0, Color.BLACK);
renderer.setXLabelsColor(Color.BLACK);
renderer.setFitLegend(true);
renderer.setShowGridX(true);
renderer.setMargins(new int[] {10, 10, 30, 10});
// setting the plot untouchable
renderer.setZoomEnabled(false, false);
renderer.setPanEnabled(false, true);
renderer.setClickEnabled(false);
renderer.setMarginsColor(Color.WHITE);
renderer.setChartTitle(mContext.getResources()
.getStringArray(R.array.plot_titles)[tabNumber]);
renderer.setChartTitleTextSize(50);
}
示例2: getChartRenderer
import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的package包/類
private XYMultipleSeriesRenderer getChartRenderer() {
XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
// TODO better style
float textSize = (float) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_SP, 12, getResources()
.getDisplayMetrics());
int marginSizeNormal = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_SP, 20, getResources()
.getDisplayMetrics());
int marginSizeLarge = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_SP, 50, getResources()
.getDisplayMetrics());
renderer.setLabelsTextSize(textSize);
renderer.setYLabelsAngle(-30.0f);
renderer.setXLabelsAngle(-30.0f);
renderer.setXLabelsColor(Color.WHITE);
renderer.setYLabelsColor(0, Color.WHITE);
renderer.setXLabelsAlign(Align.RIGHT);
renderer.setYLabelsAlign(Align.RIGHT);
renderer.setLegendTextSize(textSize);
renderer.setFitLegend(true);
renderer.setMargins(new int[] { marginSizeNormal, marginSizeLarge,
marginSizeLarge, marginSizeNormal });
renderer.setPanEnabled(true, false);
renderer.setZoomEnabled(true, false);
renderer.setZoomButtonsVisible(false);
renderer.setApplyBackgroundColor(true);
renderer.setBackgroundColor(Color.DKGRAY);
renderer.setMarginsColor(Color.BLACK);
renderer.setGridColor(Color.WHITE);
renderer.setPointSize(8);
renderer.setShowGridY(true);
renderer.setClickEnabled(false);
renderer.setXLabels(6);
return renderer;
}
示例3: setUpRenderer
import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的package包/類
private void setUpRenderer(Activity activity) {
// Now we create the renderer
XYSeriesRenderer mCurrentRenderer = new XYSeriesRenderer();
mCurrentRenderer.setLineWidth(getDPI(2));
mCurrentRenderer.setColor(activity.getResources().getColor(R.color.colorBarGraph));
// Include low and max value
mCurrentRenderer.setDisplayBoundingPoints(true);
// we add point markers
mCurrentRenderer.setPointStyle(PointStyle.CIRCLE);
mCurrentRenderer.setPointStrokeWidth(getDPI(5));
mCurrentRenderer.setShowLegendItem(false);
// Creating XYSeriesRenderer to customize expenseSeries
XYSeriesRenderer expenseRenderer = new XYSeriesRenderer();
expenseRenderer.setColor(activity.getResources().getColor(R.color.colorBarGraph2));
expenseRenderer.setPointStyle(PointStyle.POINT);
expenseRenderer.setFillPoints(true);
expenseRenderer.setLineWidth(getDPI(3));
expenseRenderer.setShowLegendItem(false);
mRenderer = new XYMultipleSeriesRenderer();
mRenderer.addSeriesRenderer(mCurrentRenderer);
mRenderer.addSeriesRenderer(expenseRenderer);
// We want to avoid black border
mRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00)); // transparent margins
// Disable Pan on two axis
mRenderer.setPanEnabled(true, false);
mRenderer.setZoomEnabled(true, false);
mRenderer.setLabelsTextSize(getDPI(15));
mRenderer.setXLabelsColor(activity.getResources().getColor(R.color.colorWhite));
mRenderer.setYLabelsColor(0, activity.getResources().getColor(R.color.colorWhite));
mRenderer.setLabelsColor(activity.getResources().getColor(R.color.colorWhite));
mRenderer.setAxesColor(activity.getResources().getColor(R.color.colorWhite));
mRenderer.setBarSpacing(0.2);
mRenderer.setShowGrid(true); // we show the grid
mRenderer.setXLabels(0);
// enable the chart click events
mRenderer.setClickEnabled(true);
mRenderer.setSelectableBuffer(10);
}
示例4: lineChartView
import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的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);
}
示例5: lineChartView_type1
import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的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();
}
}
示例6: lineChartView_type2
import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的package包/類
private void lineChartView_type2(final int type) {
if (paintChartView) {
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.line2_axis_title_text_size_value, outValue1, true);
mContext.getResources().getValue(R.dimen.line2_chart_title_text_size_value, outValue2, true);
mContext.getResources().getValue(R.dimen.line2_labels_text_size_value, outValue3, true);
mContext.getResources().getValue(R.dimen.line2_legend_text_size_value, outValue4, true);
float line2AxisTitleTextSizeValue = outValue1.getFloat();
float line2CharTitleTextSizeValue = outValue2.getFloat();
float line2LabelsTextSizeValue = outValue3.getFloat();
float line2LegendTextSizeValue = outValue4.getFloat();
XYMultipleSeriesDataset mDataset = null;
XYMultipleSeriesRenderer mRenderer = null;
switch (type) {
case 1:
mDataset = getDataset_type2(1);
break;
case 2:
mDataset = getDataset_type2(2);
break;
}
mRenderer = getRenderer_type2(type);
mRenderer.setApplyBackgroundColor(true);
mRenderer.setBackgroundColor(Color.TRANSPARENT);
mRenderer.setMarginsColor(Color.argb(0x00, 0x01, 0x01, 0x01));
mRenderer.setAxisTitleTextSize(line2AxisTitleTextSizeValue);
mRenderer.setChartTitleTextSize(line2CharTitleTextSizeValue);
mRenderer.setLabelsTextSize(line2LabelsTextSizeValue);
mRenderer.setLegendTextSize(line2LegendTextSizeValue);
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) {
switch (type) {
case 1:
UIFunctionUtils.showMessage(mContext, true, (int) seriesSelection.getValue()
+ " "
+ (isMetric ? getString(R.string.long_unit1_detail_4)
: getString(R.string.long_unit2_detail_4)));
break;
case 2:
UIFunctionUtils.showMessage(mContext, true, (int) seriesSelection.getValue()
+ " "
+ (isMetric ? getString(R.string.long_unit1_detail_2)
: getString(R.string.long_unit2_detail_2)));
break;
}
}
}
});
chartLayout.addView(mChartView);
} else {
setCorrectText();
}
}
示例7: onCreate
import org.achartengine.renderer.XYMultipleSeriesRenderer; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
// keep main display on?
if(MainActivity.prefs.getBoolean("keep_screen_on", false))
{
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
// prevent activity from falling asleep
PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
getString(R.string.app_name));
wakeLock.acquire();
// set up action bar
ActionBar actionBar = getActionBar();
if (actionBar != null)
{
actionBar.setDisplayShowTitleEnabled(true);
}
setTitle(R.string.chart);
/* get PIDs to be shown */
int positions[] = getIntent().getIntArrayExtra(POSITIONS);
// set up overall chart properties
sensorData = new XYMultipleSeriesDataset();
renderer = new XYMultipleSeriesRenderer(positions.length);
chartView = ChartFactory.getTimeChartView(this, sensorData, renderer, "H:mm:ss");
// set up global renderer
renderer.setXTitle(getString(R.string.time));
renderer.setXLabels(5);
renderer.setYLabels(5);
renderer.setGridColor(Color.DKGRAY);
renderer.setShowGrid(true);
renderer.setFitLegend(true);
renderer.setClickEnabled(false);
// set up chart data
setUpChartData(positions);
// make chart visible
setContentView(chartView);
// limit selected PIDs to selection
MainActivity.setFixedPids(pidNumbers);
// if auto hiding selected ...
if(MainActivity.prefs.getBoolean(MainActivity.PREF_AUTOHIDE,false))
{
// get autohide timeout [s]
int timeout = Integer.valueOf(
MainActivity.prefs.getString(MainActivity.PREF_AUTOHIDE_DELAY,"15") );
// auto hide toolbar
toolBarHider = new AutoHider( this,
mHandler,
MainActivity.MESSAGE_TOOLBAR_VISIBLE,
timeout * 1000);
toolBarHider.start(1000);
// wake up on touch
chartView.setOnTouchListener(toolBarHider);
}
}