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


Java LineData.setValueTextColor方法代碼示例

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


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

示例1: initializeChart

import com.github.mikephil.charting.data.LineData; //導入方法依賴的package包/類
protected void initializeChart() {
  Description description = new Description();
  description.setText("");
  messagesChart.setDescription(description);
  messagesChart.setNoDataText(getIdleText());
  messagesChart.setTouchEnabled(false);
  messagesChart.setDragEnabled(false);
  messagesChart.setPinchZoom(false);
  messagesChart.getLegend().setEnabled(false);
  messagesChart.getAxisLeft().setAxisMinimum(0);
  messagesChart.getAxisLeft().setGranularity(1f);
  messagesChart.getAxisRight().setEnabled(false);
  messagesChart.getXAxis().setAxisMinimum(0);
  messagesChart.getXAxis().setGranularity(1f);
  messagesChart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
  messagesChart.getXAxis().setValueFormatter(new DefaultAxisValueFormatter(0));

  LineData data = new LineData();
  data.setValueTextColor(Color.WHITE);
  messagesChart.setData(data);
}
 
開發者ID:tommus,項目名稱:rabbitmq-management-android,代碼行數:22,代碼來源:MessagesIndicator.java

示例2: setData

import com.github.mikephil.charting.data.LineData; //導入方法依賴的package包/類
private void setData(int count, float range) {

        // now in hours
        long now = TimeUnit.MILLISECONDS.toHours(System.currentTimeMillis());

        ArrayList<Entry> values = new ArrayList<Entry>();

        float from = now;

        // count = hours
        float to = now + count;

        // increment by 1 hour
        for (float x = from; x < to; x++) {

            float y = getRandom(range, 50);
            values.add(new Entry(x, y)); // add one entry per hour
        }

        // create a dataset and give it a type
        LineDataSet set1 = new LineDataSet(values, "DataSet 1");
        set1.setAxisDependency(AxisDependency.LEFT);
        set1.setColor(ColorTemplate.getHoloBlue());
        set1.setValueTextColor(ColorTemplate.getHoloBlue());
        set1.setLineWidth(1.5f);
        set1.setDrawCircles(false);
        set1.setDrawValues(false);
        set1.setFillAlpha(65);
        set1.setFillColor(ColorTemplate.getHoloBlue());
        set1.setHighLightColor(Color.rgb(244, 117, 117));
        set1.setDrawCircleHole(false);

        // create a data object with the datasets
        LineData data = new LineData(set1);
        data.setValueTextColor(Color.WHITE);
        data.setValueTextSize(9f);

        // set data
        mChart.setData(data);
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:41,代碼來源:LineChartTime.java

示例3: enter

import com.github.mikephil.charting.data.LineData; //導入方法依賴的package包/類
@Override
public void enter(int view) {
    super.enter(view);
    lchScope = (LineChart) findViewById(R.id.scope_chart);
    lchScope.setDrawGridBackground(false);
    //lchScope.setNoDataTextDescription("Select a Value in the ObjectBrowser to start the Scope");

    mData = new LineData();
    mData.setValueTextColor(Color.GREEN);

    // add empty data
    if (mObject1 != null) lchScope.setData(mData);

    txtScopeLastValue = (TextView) findViewById(R.id.txtScopeLastValue);
    txtScopeObjectName = (TextView) findViewById(R.id.txtScopeObjectName);

    mObject1 = ScopeHelper.object1;
    mField1 = ScopeHelper.field1;
    mElement1 = ScopeHelper.element1;

    mObject2 = ScopeHelper.object2;
    mField2 = ScopeHelper.field2;
    mElement2 = ScopeHelper.element2;

    if (mObject1 != null) {
        setScopeMetric(mObject1, mField1, mElement1);
        //lchScope.setDescription(mObject1 + "/" + mField1 + "/" + mElement1);
    }

    if (mObject2 != null) {
        setScopeMetric(mObject2, mField2, mElement2);
        //lchScope.setDescription(mObject1 + "/" + mField1 + "/" + mElement1);
    }

    txtScopeObjectName.setText(mObject1);
    relTime = System.currentTimeMillis();

}
 
開發者ID:MarcProe,項目名稱:lp2go,代碼行數:39,代碼來源:ViewControllerScope.java

示例4: onCreate

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

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

    // enable description text
    mChart.getDescription().setEnabled(true);

    // enable touch gestures
    mChart.setTouchEnabled(true);

    // enable scaling and dragging
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);
    mChart.setDrawGridBackground(false);

    // if disabled, scaling can be done on x- and y-axis separately
    mChart.setPinchZoom(true);

    // set an alternative background color
    mChart.setBackgroundColor(Color.LTGRAY);

    LineData data = new LineData();
    data.setValueTextColor(Color.WHITE);

    // add empty data
    mChart.setData(data);

    // get the legend (only possible after setting data)
    Legend l = mChart.getLegend();

    // modify the legend ...
    l.setForm(LegendForm.LINE);
    l.setTypeface(mTfLight);
    l.setTextColor(Color.WHITE);

    XAxis xl = mChart.getXAxis();
    xl.setTypeface(mTfLight);
    xl.setTextColor(Color.WHITE);
    xl.setDrawGridLines(false);
    xl.setAvoidFirstLastClipping(true);
    xl.setEnabled(true);

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(mTfLight);
    leftAxis.setTextColor(Color.WHITE);
    leftAxis.setAxisMaximum(100f);
    leftAxis.setAxisMinimum(0f);
    leftAxis.setDrawGridLines(true);

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

}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:60,代碼來源:RealtimeLineChartActivity.java

示例5: onCreateView

import com.github.mikephil.charting.data.LineData; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_voice_db_record_db, container, false);

    mDBTextView = (TextView) view.findViewById(R.id.record_db_fragment_db_tv);

    mDurationTimeView = (TextView) view.findViewById(R.id.record_db_fragment_duration_tv);

    mAverageTextView = (TextView) view.findViewById(R.id.record_db_fragment_average_tv);

    mMaxTextView = (TextView) view.findViewById(R.id.record_db_fragment_max_tv);

    mBtn = (Button) view.findViewById(R.id.record_db_fragment_switch_btn);
    mBtn.setOnClickListener(this);

    mLineChart = (LineChart) view.findViewById(R.id.record_db_fragment_info_lc);
    mLineChart.setOnChartValueSelectedListener(this);
    // 設置表描述為不可見
    mLineChart.getDescription().setEnabled(false);
    // 設置表描述可見,顏色值以及顯示的文本
    // mLineChart.getDescription().setEnabled(true);
    // mLineChart.getDescription().setText(getString(R.string.db));
    // mLineChart.getDescription().setTextColor(Color.WHITE);
    // enable touch gestures
    mLineChart.setTouchEnabled(true);
    // enable scaling and dragging
    mLineChart.setDragEnabled(true);
    mLineChart.setScaleEnabled(true);
    mLineChart.setDrawGridBackground(false);
    // if disabled, scaling can be done on x- and y-axis separately
    mLineChart.setPinchZoom(true);
    // set an alternative background color
    mLineChart.setBackgroundColor(Color.parseColor("#6A1B9A") );
    LineData data = new LineData();
    data.setValueTextColor(Color.WHITE);

    // add empty data
    mLineChart.setData(data);

    // get the legend (only possible after setting data)
    Legend l = mLineChart.getLegend();

    // modify the legend ...
    l.setForm(Legend.LegendForm.LINE);
    //l.setTypeface(mTfLight);
    l.setTextColor(Color.WHITE);

    // 獲得圖表的x軸
    XAxis xAxis = mLineChart.getXAxis();
    // 設置x軸的文本顏色為白色
    xAxis.setTextColor(Color.WHITE);
    // 不設置縱向的網格線,即與x軸垂直的線
    xAxis.setDrawGridLines(false);
    // 避免圖表剪輯的邊緣是屏幕
    xAxis.setAvoidFirstLastClipping(true);
    // 設置x軸可見
    xAxis.setEnabled(true);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);

    YAxis leftYAxis = mLineChart.getAxisLeft();
    leftYAxis.setTextColor(Color.WHITE);
    leftYAxis.setAxisMaximum(100f);
    leftYAxis.setAxisMinimum(0f);
    leftYAxis.setDrawGridLines(true);
    // 獲取右y軸並將其設置為可見
    YAxis rightYAxis  = mLineChart.getAxisRight();
    rightYAxis.setEnabled(true);
    rightYAxis.setDrawGridLines(false);
    // 設置與背景顏色相同使文本不可見
    rightYAxis.setTextColor(Color.parseColor("#6A1B9A"));

    addEntry(UserInfo.getInt(getContext(),"AverageDb"));
    return view;
}
 
開發者ID:Alex-ZHOU,項目名稱:VMAndroid,代碼行數:76,代碼來源:RecordDBFragment.java

示例6: onCreateView

import com.github.mikephil.charting.data.LineData; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_store_db_record, container, false);
    mDBTextView = (TextView) view.findViewById(R.id.store_record_db_fragment_db_tv);

    mDurationTimeView = (TextView) view.findViewById(R.id.store_record_db_fragment_duration_tv);

    mAverageTextView = (TextView) view.findViewById(R.id.store_record_db_fragment_average_tv);

    mMaxTextView = (TextView) view.findViewById(R.id.store_record_db_fragment_max_tv);

    mBtn = (Button) view.findViewById(R.id.store_record_db_fragment_switch_btn);
    mBtn.setOnClickListener(this);

    mLineChart = (LineChart) view.findViewById(R.id.store_record_db_fragment_info_lc);
    mLineChart.setOnChartValueSelectedListener(this);
    // 設置表描述為不可見
    mLineChart.getDescription().setEnabled(false);
    // 設置表描述可見,顏色值以及顯示的文本
    // mLineChart.getDescription().setEnabled(true);
    // mLineChart.getDescription().setText(getString(R.string.db));
    // mLineChart.getDescription().setTextColor(Color.WHITE);
    // enable touch gestures
    mLineChart.setTouchEnabled(true);
    // enable scaling and dragging
    mLineChart.setDragEnabled(true);
    mLineChart.setScaleEnabled(true);
    mLineChart.setDrawGridBackground(false);
    // if disabled, scaling can be done on x- and y-axis separately
    mLineChart.setPinchZoom(true);
    // set an alternative background color
    mLineChart.setBackgroundColor(Color.parseColor("#6A1B9A"));
    LineData data = new LineData();
    data.setValueTextColor(Color.WHITE);

    // add empty data
    mLineChart.setData(data);

    // get the legend (only possible after setting data)
    Legend l = mLineChart.getLegend();

    // modify the legend ...
    l.setForm(Legend.LegendForm.LINE);
    //l.setTypeface(mTfLight);
    l.setTextColor(Color.WHITE);

    // 獲得圖表的x軸
    XAxis xAxis = mLineChart.getXAxis();
    // 設置x軸的文本顏色為白色
    xAxis.setTextColor(Color.WHITE);
    // 不設置縱向的網格線,即與x軸垂直的線
    xAxis.setDrawGridLines(false);
    // 避免圖表剪輯的邊緣是屏幕
    xAxis.setAvoidFirstLastClipping(true);
    // 設置x軸可見
    xAxis.setEnabled(true);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);

    YAxis leftYAxis = mLineChart.getAxisLeft();
    leftYAxis.setTextColor(Color.WHITE);
    leftYAxis.setAxisMaximum(100f);
    leftYAxis.setAxisMinimum(0f);
    leftYAxis.setDrawGridLines(true);
    // 獲取右y軸並將其設置為可見
    YAxis rightYAxis = mLineChart.getAxisRight();
    rightYAxis.setEnabled(true);
    rightYAxis.setDrawGridLines(false);
    // 設置與背景顏色相同使文本不可見
    rightYAxis.setTextColor(Color.parseColor("#6A1B9A"));

    addEntry(UserInfo.getInt(getContext(), "AverageDb"));
    return view;
}
 
開發者ID:Alex-ZHOU,項目名稱:VMAndroid,代碼行數:75,代碼來源:StoreDbRecordFragment.java

示例7: onCreate

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

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

    // no description text
    mChart.setDescription("");
    mChart.setNoDataTextDescription("You need to provide data for the chart.");

    // enable touch gestures
    mChart.setTouchEnabled(true);

    // enable scaling and dragging
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);
    mChart.setDrawGridBackground(false);

    // if disabled, scaling can be done on x- and y-axis separately
    mChart.setPinchZoom(true);

    // set an alternative background color
    mChart.setBackgroundColor(Color.LTGRAY);

    LineData data = new LineData();
    data.setValueTextColor(Color.WHITE);

    // add empty data
    mChart.setData(data);

    Typeface tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");

    // get the legend (only possible after setting data)
    Legend l = mChart.getLegend();

    // modify the legend ...
    // l.setPosition(LegendPosition.LEFT_OF_CHART);
    l.setForm(LegendForm.LINE);
    l.setTypeface(tf);
    l.setTextColor(Color.WHITE);

    XAxis xl = mChart.getXAxis();
    xl.setTypeface(tf);
    xl.setTextColor(Color.WHITE);
    xl.setDrawGridLines(false);
    xl.setAvoidFirstLastClipping(true);
    xl.setSpaceBetweenLabels(5);
    xl.setEnabled(true);

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(tf);
    leftAxis.setTextColor(Color.WHITE);
    leftAxis.setAxisMaxValue(100f);
    leftAxis.setAxisMinValue(0f);
    leftAxis.setDrawGridLines(true);

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

}
 
開發者ID:rahulmaddineni,項目名稱:Stayfit,代碼行數:65,代碼來源:RealtimeLineChartActivity.java

示例8: SetupChart

import com.github.mikephil.charting.data.LineData; //導入方法依賴的package包/類
public void SetupChart() {
    lineChart = (LineChart) myLayout.findViewById(R.id.chart);
    lineChart.setDescription("");
    lineChart.setDrawBorders(false);
    lineChart.setNoDataTextDescription("You need to provide data for the chart.");
    lineChart.setDrawGridBackground(false);
    lineChart.setOnChartValueSelectedListener(this);
    lineChart.setTouchEnabled(true);
    lineChart.setDragEnabled(false);
    lineChart.setPinchZoom(false);
    lineChart.setScaleXEnabled(true);
    lineChart.setScaleYEnabled(true);
    lineChart.invalidate();
    LineData data = new LineData();
    data.setValueTextColor(Color.WHITE);
    // add empty data
    lineChart.setData(data);
    // get the legend (only possible after setting data)
    Legend l = lineChart.getLegend();
    l.setEnabled(false);
    // x axis setup
    XAxis xl = lineChart.getXAxis();
    xl.setTextColor(Color.WHITE);
    xl.setDrawGridLines(false);
    xl.setAvoidFirstLastClipping(false);
    xl.setSpaceBetweenLabels(3);
    xl.setEnabled(true);
    xl.setDrawAxisLine(false);
    xl.removeAllLimitLines();
    //right y axis setup
    YAxis rightAxis = lineChart.getAxisRight();
    rightAxis.setEnabled(false);
    //left y axis setup
    YAxis leftAxis = lineChart.getAxisLeft();
    leftAxis.setTextColor(Color.WHITE);
    leftAxis.setLabelCount(6, true);
    leftAxis.setAxisMaxValue(400f);
    leftAxis.setAxisMinValue(0f);
    leftAxis.setDrawGridLines(false);
    leftAxis.setStartAtZero(false);
    leftAxis.setEnabled(true);
    leftAxis.setDrawAxisLine(false);
    leftAxis.setDrawZeroLine(false);
    leftAxis.setGranularityEnabled(false);
    //define min max line
    LimitLine max = new LimitLine(150f);
    max.enableDashedLine(10f, 10f, 0f);
    LimitLine min = new LimitLine(50f);
    min.enableDashedLine(10f, 10f, 0f);
    // reset all limit lines to avoid overlapping lines
    leftAxis.removeAllLimitLines();
    //add min max line
    leftAxis.addLimitLine(max);
    leftAxis.addLimitLine(min);

    lineChart.invalidate();
}
 
開發者ID:LadyViktoria,項目名稱:wearDrip,代碼行數:58,代碼來源:wearDripWatchFace.java


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