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


Java BarChart.setOnChartGestureListener方法代碼示例

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


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

示例1: onCreateView

import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.frag_simple_bar, container, false);
    
    // create a new chart object
    mChart = new BarChart(getActivity());
    mChart.getDescription().setEnabled(false);
    mChart.setOnChartGestureListener(this);
    
    MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
    mv.setChartView(mChart); // For bounds control
    mChart.setMarker(mv);

    mChart.setDrawGridBackground(false);
    mChart.setDrawBarShadow(false);
    
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
    
    mChart.setData(generateBarData(1, 20000, 12));
    
    Legend l = mChart.getLegend();
    l.setTypeface(tf);
    
    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(tf);
    leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)

    mChart.getAxisRight().setEnabled(false);
    
    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(false);
    
    // programatically add the chart
    FrameLayout parent = (FrameLayout) v.findViewById(R.id.parentLayout);
    parent.addView(mChart);
    
    return v;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:39,代碼來源:BarChartFrag.java

示例2: onCreateView

import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.frag_simple_bar, container, false);
    
    // create a new chart object
    mChart = new BarChart(getActivity());
    mChart.setDescription("");
    mChart.setOnChartGestureListener(this);
    
    MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);

    mChart.setMarkerView(mv);

    mChart.setDrawGridBackground(false);
    mChart.setDrawBarShadow(false);
    
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
    
    mChart.setData(generateBarData(1, 20000, 12));
    
    Legend l = mChart.getLegend();
    l.setTypeface(tf);
    
    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(tf);
    leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)

    mChart.getAxisRight().setEnabled(false);
    
    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(false);
    
    // programatically add the chart
    FrameLayout parent = (FrameLayout) v.findViewById(R.id.parentLayout);
    parent.addView(mChart);
    
    return v;
}
 
開發者ID:rahulmaddineni,項目名稱:Stayfit,代碼行數:39,代碼來源:BarChartFrag.java

示例3: onCreate

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

        dbInit(getIntent());
        sparkAddressMap = new HashMap<String, String>();
        sparkAddressMap.put("BlackMage", "53ff70065075535143191087");
        sparkAddressMap.put("WhiteMage", "50ff6e065067545631270587");
        sparkAddressMap.put("GreenMage", "48ff70065067555028111587");

        mChart = (BarChart) findViewById(R.id.chart1);
        mChart.setOnChartValueSelectedListener(this);
        mChart.setOnChartGestureListener(this);

        mChart.setDrawValueAboveBar(true);
        mChart.setDescription("");

        // Dario flag changes
        mChart.setDragEnabled(false);
        mChart.setScaleEnabled(false);

        // Set max on the chart to 10 for now, should never go above 3 on demo
        mChart.setMaxVisibleValueCount(10);

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

        // Disable background
        mChart.setDrawGridBackground(false);

        XAxis xAxis = mChart.getXAxis();
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        xAxis.setDrawGridLines(false);

        intFormat = new MyValueFormatter();

        YAxis leftAxis = mChart.getAxisLeft();
        leftAxis.setValueFormatter(intFormat);

        YAxis rightAxis = mChart.getAxisRight();
        rightAxis.setEnabled(false);

        setData();

        Legend l = mChart.getLegend();
        l.setEnabled(false);

        /*** Begin Repeating Alarm Setup ***/
        int pollFrequencySeconds = 5;
        Context context = getApplicationContext();
        alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
        Intent intent = new Intent(context, AlarmReceiver.class);
        intent.putExtra("myGlass", myGlass);
//        Log.d(TAG, "Input to alarm: " + myGlass);
        intent.putExtra("myAddr", sparkAddressMap.get(myGlass));
        alarmIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
        alarmMgr.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
                1000 * pollFrequencySeconds,
                1000 * pollFrequencySeconds,
                alarmIntent);
        Toast.makeText(this, "Alarm Set", Toast.LENGTH_SHORT).show();

        /*** Begin UI Update Listener ***/
        receiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                setDataFromJSON(intent.getStringExtra(PollGameStatusService.SCORE_KEY));
            }
        };
    }
 
開發者ID:kashev,項目名稱:wizardstaff,代碼行數:72,代碼來源:ScoreboardActivity.java


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