com.github.mikephil.charting.listener.OnChartValueSelectedListener Java Examples
The following examples show how to use
com.github.mikephil.charting.listener.OnChartValueSelectedListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RideDetailActivity.java From android-ponewheel with MIT License | 6 votes |
private void addDragListenerMarkerMaker(LineChart speedChart) { speedChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() { @Override public void onValueSelected(Entry entry, Highlight h) { Long entryX = (long) entry.getX(); if (timeLocationMap.containsKey(entryX)) { clearAllMarkersFromMap(); LatLng latLng = timeLocationMap.get(entryX); mapMarkers.add(googleMap.addMarker(new MarkerOptions().position(latLng))); } } @Override public void onNothingSelected() { clearAllMarkersFromMap(); } }); }
Example #2
Source File: CountFragment.java From AccountBook with GNU General Public License v3.0 | 6 votes |
/** * 初始化图表 */ private void initChart() { ChartUtils.initPieChart(mChartView); mChartView.setOnChartValueSelectedListener(new OnChartValueSelectedListener() { @Override public void onValueSelected(Entry e, Highlight h) { // 单独显示每个分类的统计情况 PieEntry entry = (PieEntry) e; float money = entry.getValue(); String type = entry.getLabel(); mChartView.setCenterText(generateCenterSpannableText( String.valueOf(money), "(".concat(type).concat(")"))); } @Override public void onNothingSelected() { setChartData(); } }); }
Example #3
Source File: GraphicActivity.java From ToDay with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_graphic); pieChart = (PieChart) findViewById(R.id.idPieChart); pieChart.setRotationEnabled(true); pieChart.setHoleRadius(25f); pieChart.setTransparentCircleAlpha(0); pieChart.setCenterText("Төлөвлөгөө"); pieChart.setCenterTextSize(10); pieChart.setDrawEntryLabels(true); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); addDataSet(); pieChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() { @Override public void onValueSelected(Entry e, Highlight h) { Log.d(TAG, "onValueSelected: Value select from chart."); Log.d(TAG, "onValueSelected: " + e.toString()); Log.d(TAG, "onValueSelected: " + h.toString()); int pos1 = e.toString().indexOf("(sum): "); String sales = e.toString().substring(pos1 + 7); for(int i = 0; i < yData.length; i++){ if(yData[i] == Float.parseFloat(sales)){ pos1 = i; break; } } String employee = xData[pos1 + 1]; Toast.makeText(GraphicActivity.this, "Employee " + employee + "\n" + "Sales: $" + sales + "K", Toast.LENGTH_LONG).show(); } @Override public void onNothingSelected() { } }); }
Example #4
Source File: ReportAdapter.java From outlay with Apache License 2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder instanceof ReportViewHolder) { ReportViewHolder reportHolder = (ReportViewHolder) holder; Report currentReport = categorizedExpenses.getReport(position - 1); Category currentCategory = categorizedExpenses.getCategory(position - 1); reportHolder.amountText.setText(NumberUtils.formatAmount(currentReport.getTotalAmount())); reportHolder.titleText.setText(currentCategory.getTitle()); IconUtils.loadCategoryIcon(currentCategory.getIcon(), reportHolder.icon); reportHolder.progressLayout.setMaxProgress((int) (maxProgress * 10)); reportHolder.progressLayout.setCurrentProgress(currentReport.getTotalAmount().multiply(new BigDecimal(10)).intValue()); reportHolder.icon.setIconColor(currentCategory.getColor()); reportHolder.reportContainer.setOnClickListener(v -> { if (onItemClickListener != null) { onItemClickListener.onItemClicked(currentCategory, currentReport); } }); //reportHolder.progressLayout.setLoadedColor(currentReport.getColor()); } else if (holder instanceof ChartViewHolder) { ChartViewHolder charViewHolder = (ChartViewHolder) holder; Context context = charViewHolder.chart.getContext(); updateChartData(charViewHolder.chart); charViewHolder.prev.setImageDrawable(IconUtils.getToolbarIcon(context, MaterialDesignIconic.Icon.gmi_arrow_left)); charViewHolder.next.setImageDrawable(IconUtils.getToolbarIcon(context, MaterialDesignIconic.Icon.gmi_arrow_right)); if (charViewHolder.chart.isDrawEntryLabelsEnabled()) { charViewHolder.hideLabels.setImageDrawable(IconUtils.getToolbarIcon(context, MaterialDesignIconic.Icon.gmi_format_size)); } else { charViewHolder.hideLabels.setImageDrawable(IconUtils.getToolbarIcon(context, MaterialDesignIconic.Icon.gmi_format_clear)); } charViewHolder.hideLabels.setOnClickListener(view -> { charViewHolder.chart.setDrawEntryLabels(!charViewHolder.chart.isDrawEntryLabelsEnabled()); if (charViewHolder.chart.isDrawEntryLabelsEnabled()) { charViewHolder.hideLabels.setImageDrawable(IconUtils.getToolbarIcon(context, MaterialDesignIconic.Icon.gmi_format_size)); } else { charViewHolder.hideLabels.setImageDrawable(IconUtils.getToolbarIcon(context, MaterialDesignIconic.Icon.gmi_format_clear)); } charViewHolder.chart.invalidate(); }); //charViewHolder.chart.animateY(1000, Easing.EasingOption.EaseInOutQuad); charViewHolder.chart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() { @Override public void onValueSelected(Entry e, Highlight h) { if (onItemClickListener != null) { //onItemClickListener.onItemClicked(reports.get(h.getXIndex())); } } @Override public void onNothingSelected() { } }); } }
Example #5
Source File: Chart.java From StockChart-MPAndroidChart with MIT License | 2 votes |
/** * set a selection listener for the chart * * @param l */ public void setOnChartValueSelectedListener(OnChartValueSelectedListener l) { this.mSelectionListener = l; }
Example #6
Source File: Chart.java From Ticket-Analysis with MIT License | 2 votes |
/** * set a selection listener for the chart * * @param l */ public void setOnChartValueSelectedListener(OnChartValueSelectedListener l) { this.mSelectionListener = l; }
Example #7
Source File: Chart.java From android-kline with Apache License 2.0 | 2 votes |
/** * set a selection listener for the chart * * @param l */ public void setOnChartValueSelectedListener(OnChartValueSelectedListener l) { this.mSelectionListener = l; }
Example #8
Source File: Chart.java From iMoney with Apache License 2.0 | 2 votes |
/** * set a selection listener for the chart * * @param l */ public void setOnChartValueSelectedListener(OnChartValueSelectedListener l) { this.mSelectionListener = l; }
Example #9
Source File: Chart.java From Stayfit with Apache License 2.0 | 2 votes |
/** * set a selection listener for the chart * * @param l */ public void setOnChartValueSelectedListener(OnChartValueSelectedListener l) { this.mSelectionListener = l; }
Example #10
Source File: Chart.java From NetKnight with Apache License 2.0 | 2 votes |
/** * set a selection listener for the chart * * @param l */ public void setOnChartValueSelectedListener(OnChartValueSelectedListener l) { this.mSelectionListener = l; }