當前位置: 首頁>>代碼示例>>Java>>正文


Java BarChart類代碼示例

本文整理匯總了Java中com.github.mikephil.charting.charts.BarChart的典型用法代碼示例。如果您正苦於以下問題:Java BarChart類的具體用法?Java BarChart怎麽用?Java BarChart使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BarChart類屬於com.github.mikephil.charting.charts包,在下文中一共展示了BarChart類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getView

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
/**
 * Returns the view to display bar chart
 */
public View getView(final Activity activity, View rootView) {
    this.activity = activity;
    View view = null;
    LayoutInflater inflater;
    Context context = activity.getApplicationContext();
    onOperationIssueChange(rootView);


    if (context != null) {
        if (view == null && context != null && activity != null) {
            inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = inflater.inflate(R.layout.statistics_view, null);
        }

        BarChart barChart = (BarChart) view.findViewById(R.id.chart);
        UtilsRG.info("chart init: " + barChart);
        initBarChartConfiguration(activity, barChart);
        initBarChartDataAsync(activity, barChart);

        initInValidGoNoGoGameLineChart(activity, view);
        addDataToInValidGoNoGoGameLineChart(activity);
    }
    return view;
}
 
開發者ID:lidox,項目名稱:reaction-test,代碼行數:28,代碼來源:BarChartView.java

示例2: onCreate

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.timevis_layout);

    barchart = (BarChart) findViewById(R.id.barchart);

    Intent intent = getIntent();
    String ot = intent.getExtras().getString("ot");
    String pt = intent.getExtras().getString("pt");
    String lt = intent.getExtras().getString("lt");
    String pert = intent.getExtras().getString("pert");


    Float otf = Float.valueOf(ot);
    Float ptf = Float.valueOf(pt);
    Float ltf = Float.valueOf(lt);
    Float pertf = Float.valueOf(pert);


    List<BarEntry> entries = new ArrayList<>();
    entries.add(new BarEntry(0f, otf.floatValue()));
    entries.add(new BarEntry(1f, ptf.floatValue()));
    entries.add(new BarEntry(2f, ltf.floatValue()));
    entries.add(new BarEntry(3f, pertf.floatValue()));


    BarDataSet set = new BarDataSet(entries, "Time Visualization");
    BarData data = new BarData(set);
    data.setBarWidth(0.9f); // set custom bar width
    barchart.setData(data);
    barchart.setFitBars(true); // make the x-axis fit exactly all bars
    barchart.invalidate();


}
 
開發者ID:AswinVasudevan21,項目名稱:MobileProjectManagement,代碼行數:37,代碼來源:TimeVisualization.java

示例3: onCreate

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_realm_wiki);

    lineChart = (LineChart) findViewById(R.id.lineChart);
    barChart = (BarChart) findViewById(R.id.barChart);
    setup(lineChart);
    setup(barChart);

    lineChart.setExtraBottomOffset(5f);
    barChart.setExtraBottomOffset(5f);

    lineChart.getAxisLeft().setDrawGridLines(false);
    lineChart.getXAxis().setDrawGridLines(false);
    lineChart.getXAxis().setLabelCount(5);
    lineChart.getXAxis().setGranularity(1f);
    barChart.getAxisLeft().setDrawGridLines(false);
    barChart.getXAxis().setDrawGridLines(false);
    barChart.getXAxis().setLabelCount(5);
    barChart.getXAxis().setGranularity(1f);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:25,代碼來源:RealmWikiExample.java

示例4: onCreateViewHolder

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
    switch (viewType) {
        default:
        case Model.TEXT_TYPE:
            return new ViewHolderText(new TextView(parent.getContext()));
        case Model.IMAGE_TYPE:
            return new ViewHolderImage(new ImageView(parent.getContext()));
        case Model.TWEET_TYPE:
            return new ViewHolderTweet(LayoutInflater.from(parent.getContext()).inflate(R.layout.tweet_card, parent, false));
        case Model.COMMENT_TYPE:
            return new ViewHolderText(new TextView(parent.getContext()));
        case Model.GRAPH_TYPE_BARS:
            return new ViewHolderChart<>(new HorizontalBarChart(parent.getContext()));
        case Model.GRAPH_TYPE_COLUMNS:
            return new ViewHolderChart<>(new BarChart(parent.getContext()));
    }
}
 
開發者ID:MBach,項目名稱:LeMondeRssReader,代碼行數:20,代碼來源:ArticleAdapter.java

示例5: getModelType

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
static int getModelType(Chart chart) {
    if (chart == null) {
        return Model.UNKNOWN_TYPE;
    } else {
        String type = chart.getTag().toString();
        if (HorizontalBarChart.class.getSimpleName().equals(type)) {
            Log.d(TAG, "HorizontalBarChart");
            return Model.GRAPH_TYPE_BARS;
        } else if (BarChart.class.getSimpleName().equals(type)) {
            Log.d(TAG, "BarChart");
            return Model.GRAPH_TYPE_COLUMNS;
        } else {
            return Model.UNKNOWN_TYPE;
        }
    }
}
 
開發者ID:MBach,項目名稱:LeMondeRssReader,代碼行數:17,代碼來源:GraphExtractor.java

示例6: onCreate

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_realm_wiki);

    lineChart = (LineChart) findViewById(R.id.lineChart);
    barChart = (BarChart) findViewById(R.id.barChart);
    setup(lineChart);
    setup(barChart);

    lineChart.setExtraBottomOffset(5f);
    barChart.setExtraBottomOffset(5f);

    lineChart.getAxisLeft().setDrawGridLines(false);
    lineChart.getXAxis().setDrawGridLines(false);
    barChart.getAxisLeft().setDrawGridLines(false);
    barChart.getXAxis().setDrawGridLines(false);
}
 
開發者ID:rahulmaddineni,項目名稱:Stayfit,代碼行數:21,代碼來源:RealmWikiExample.java

示例7: onCreate

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);

    // enable for testing
    if (true) {
        // demoBarChart();
        demoBarChartStacked();
    } else {
        // hide UI component
        BarChart barChart = (BarChart) findViewById(R.id.chart);
        barChart.setVisibility(View.INVISIBLE);
    }

    // show device configuration
    Toast.makeText(getApplicationContext(),
            getSizeName(getApplicationContext()) + " " + getResources().getConfiguration(),
            Toast.LENGTH_LONG).show();
}
 
開發者ID:thilo20,項目名稱:MachiKoroPad,代碼行數:21,代碼來源:TestActivity.java

示例8: onCreate

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chart);

    barChart = (BarChart) findViewById(R.id.barChart);
    horizontalBarChart = (HorizontalBarChart) findViewById(R.id.horizontalChart);

    Bundle extras = getIntent().getExtras();
    chartDataName = extras.getStringArrayList(keyName);
    chartDataValue = extras.getIntegerArrayList(keyValue);
    title = extras.getString(keyTitle);
    setTitle(title);

    populateChart();
}
 
開發者ID:fga-gpp-mds,項目名稱:2016.2-CidadeDemocratica,代碼行數:17,代碼來源:ChartActivity.java

示例9: StatisticsCache

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
public StatisticsCache(AppCompatActivity activity)
{
    this.activity = activity;

    titleTextView = (TextView) activity.findViewById(R.id.textview_stats_title);
    chart = (BarChart) activity.findViewById(R.id.chart);
    totalTextView = (TextView) activity.findViewById(R.id.textview_stats_total);

    unitsTextView = (TextView) activity.findViewById(R.id.textview_stats_currency);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    String defaultCurrency = activity.getResources().getString(R.string.currency);
    currency = prefs.getString(SettingsKeys.CURRENCY, defaultCurrency);
    unitsTextView.setText(currency);

    rangeFromTextView = (TextView) activity.findViewById(R.id.textview_stats_range_from);
    rangeToTextView = (TextView) activity.findViewById(R.id.textview_stats_range_to);
    groupBySpinner = (Spinner) activity.findViewById(R.id.spinner_stats_group_by);
    valuesSpinner = (Spinner) activity.findViewById(R.id.spinner_stats_values);

    datePattern = activity.getResources().getString(R.string.date_short_pattern);
    dateLanguage = activity.getResources().getString(R.string.language);
    numberFormat = activity.getResources().getString(R.string.number_format_2_decimals);
}
 
開發者ID:SecUSo,項目名稱:privacy-friendly-shopping-list,代碼行數:24,代碼來源:StatisticsCache.java

示例10: insertChartSample

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
/**
 * Procedure to add last DetailsData sample to chart.
 * @param data
 * @param chart
 */
private void insertChartSample(DetailsData data, BarChart chart, @Nullable Beacon beacon) {
    data.insertAndUpdate(beacon);
    BarData barData = chart.getData();
    BarDataSet set = barData.getDataSetByIndex(0);
    if(set.getEntryCount() == mPresenter.getSamplesCount()) {
        barData.removeXValue(0);
        set.removeEntry(0);
        for (Entry entry : set.getYVals()) {
            entry.setXIndex(entry.getXIndex() - 1);
        }
    }
    barData.addXValue(" ");
    BarEntry newEntry = new BarEntry(
            data.getCurrentValue(mPresenter.getMode()),
            set.getEntryCount());
    barData.addEntry(newEntry, 0);
    setChartRange(chart, data, mPresenter.getAutoscale());
    setChartAverage(chart, data, mPresenter.getAverage());

    chart.notifyDataSetChanged();
    chart.invalidate();
}
 
開發者ID:stanleyguevara,項目名稱:beaconradar,代碼行數:28,代碼來源:DetailsActivity.java

示例11: onCreate

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    simpleTrialButton = (Button) findViewById(R.id.simple);
    complexTrialButton = (Button) findViewById(R.id.complex);
    resultsLabel = (TextView) findViewById(R.id.resultsLabel);
    resultsContainer = (ScrollView) findViewById(R.id.resultsContainer);
    resultsTextView = (TextView) findViewById(R.id.results);
    progressBar = (ProgressBar) findViewById(R.id.progress);
    progressBar.setIndeterminate(true);
    chartView = (BarChart) findViewById(R.id.chart);

    if (savedInstanceState != null) {
        runningTests = savedInstanceState.getBoolean(STATE_RUNNING_TESTS);
        runningTestName = savedInstanceState.getString(STATE_TEST_NAME);
        chartEntrySets = (LinkedHashMap<String, ArrayList<BarEntry>>) savedInstanceState.getSerializable(STATE_MAPDATA);

        setBusyUI(runningTests, runningTestName);
        if (!runningTests && (chartEntrySets.size() > 0)) {
            // graph existing data
            initChart();
        }
    }
}
 
開發者ID:Raizlabs,項目名稱:AndroidDatabaseLibraryComparison,代碼行數:27,代碼來源:MainActivity.java

示例12: initViews

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
/**
 * Initialize all needed views.
 */
private void initViews() {
    // get views for overview
    llOverviewWrapper = (LinearLayout) findViewById(R.id.overview_wrapper);
    tvOverviewParticipants = (TextView) findViewById(R.id.tv_overview_participants);
    tvOverviewPassed = (TextView) findViewById(R.id.tv_overview_passed);
    tvOverviewAverage = (TextView) findViewById(R.id.tv_overview_average);
    barChart = (BarChart) findViewById(R.id.bar_chart);
    tvOverviewNotPossible = (TextView) findViewById(R.id.tv_overview_not_possible);
    tvOverviewNotPossible.setText(Html.fromHtml(getString(R.string.overview_not_possible, FaqDataProvider.GO_TO_WHY_NO_GRADING)));
    tvOverviewNotPossible.setMovementMethod(LinkMovementMethod.getInstance());
    llRootView = (LinearLayout) findViewById(R.id.ll_root_view);
    tvCustomGradeEntry = (TextView) findViewById(R.id.tv_custom_grade_entry);

    initPullToRefresh();
}
 
開發者ID:MyGrades,項目名稱:mygrades-app,代碼行數:19,代碼來源:GradeDetailedActivity.java

示例13: BarChartCustom

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
public BarChartCustom(BarChart graphical, ArrayList<BarEntry> entries, String entriesLegend, ArrayList<String> labels, String chartDecription)
{
    this.entries = entries;
    this.chart = graphical;
    this.dataset = new BarDataSet(entries, entriesLegend);
    this.data = new BarData(labels, this.dataset);
    this.colors = new ArrayList<>();
    this.yLeftAxis = chart.getAxisLeft();
    this.yRightAxis = chart.getAxisRight();
    this.xAxis = chart.getXAxis();
    chart.setTouchEnabled(false);
    this.average = new LimitLine(getAverage(), String.format("%1$s : %2$.2f", "Moyenne", getAverage()));
    this.average.setTextSize(10);
    this.average.setLineColor(Color.RED);
    this.average.setLineWidth(1.5f);
    this.yLeftAxis.addLimitLine(average);
    this.average.setEnabled(false);
    this.legend = chart.getLegend();
    if(chartDecription!= null)
        chart.setDescription(chartDecription);
    else chart.setDescription("");
    setDefaultChart();
    setDefaultLegend();
    setDefaultAxes();
}
 
開發者ID:pfiorentino,項目名稱:eCarNet,代碼行數:26,代碼來源:BarChartCustom.java

示例14: onCreateView

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        //return buildChart();
        mLayout = (LinearLayout) inflater.inflate(R.layout.chart_bar_fragment, container, false);

        mChart = (BarChart) mLayout.findViewById(R.id.chartBar);
        mChart.setOnChartValueSelectedListener(this);
        mChart.setDescription("");

//      mChart.setDrawBorders(true);

        // scaling can now only be done on x- and y-axis separately
        mChart.setPinchZoom(false);

        mChart.setDrawBarShadow(false);

        mChart.setDrawGridBackground(false);

        return mLayout;
    }
 
開發者ID:moneymanagerex,項目名稱:android-money-manager-ex,代碼行數:21,代碼來源:IncomeVsExpensesChartFragment.java

示例15: onCreateView

import com.github.mikephil.charting.charts.BarChart; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater,
		@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
	View rootView = inflater.inflate(R.layout.graph_reports, container,
			false);

	initializeFields(rootView);

	setEventListeners();

	lineChart = new LineChart(context);
	barChart = new BarChart(context);

	((MainActivity) activity).onSectionAttached("Graphs");

	return rootView;
}
 
開發者ID:levanlevi,項目名稱:AgWeatherNet,代碼行數:18,代碼來源:StationGraph.java


注:本文中的com.github.mikephil.charting.charts.BarChart類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。