当前位置: 首页>>代码示例>>Java>>正文


Java XAxis类代码示例

本文整理汇总了Java中com.github.mikephil.charting.components.XAxis的典型用法代码示例。如果您正苦于以下问题:Java XAxis类的具体用法?Java XAxis怎么用?Java XAxis使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XAxis类属于com.github.mikephil.charting.components包,在下文中一共展示了XAxis类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dataSortedOnDay

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
private void dataSortedOnDay(int year, int month, int dayOfMonth) {
    if (graphValuesQuery != null)
        graphValuesQuery.removeEventListener(graphValuesListener);

    XAxis xaxis = chart.getXAxis();
    //xaxis.setTextSize(18f);
    xaxis.setDrawLabels(true);
    xaxis.setAxisMinimum(-0.5f);
    xaxis.setAxisMaximum(23.5f);
    xaxis.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE);

    chart.getData().getDataSetByIndex(0).clear();
    getBarData().getDataSetByIndex(0).setLabel(getString(R.string.hour_of_day_string));

    String path = String.format("/cow_data/%s/%d/%d/%d", cowId, year, month, dayOfMonth);
    graphValuesQuery = FirebaseHelper.getInstance().getDatabase().getReference().child(path).orderByKey();

    graphValuesQuery.addChildEventListener(graphValuesListener);
}
 
开发者ID:ekalyvio,项目名称:CowBit,代码行数:20,代码来源:CowDetailsActivity.java

示例2: dataSortedOnYear

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
private void dataSortedOnYear(int year) {
    if (graphValuesQuery != null)
        graphValuesQuery.removeEventListener(graphValuesListener);

    XAxis xaxis = chart.getXAxis();
    //xaxis.setTextSize(18f);
    xaxis.setDrawLabels(true);
    xaxis.setAxisMinimum(0.5f);
    xaxis.setAxisMaximum(12.5f);
    xaxis.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE);

    chart.getData().getDataSetByIndex(0).clear();
    getBarData().getDataSetByIndex(0).setLabel(getString(R.string.month_of_year_string));

    String path = String.format("/cow_data/%s/%d", cowId, year);
    graphValuesQuery = FirebaseHelper.getInstance().getDatabase().getReference().child(path).orderByKey();

    graphValuesQuery.addChildEventListener(graphValuesListener);
}
 
开发者ID:ekalyvio,项目名称:CowBit,代码行数:20,代码来源:CowDetailsActivity.java

示例3: setAxis

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
@Override
public void setAxis(AnalysisXAxisValueFormatter formatter, float yAxisMaxValue) {

    XAxis xAxis = mRadarChart.getXAxis();
    xAxis.setTextSize(9f);
    xAxis.setYOffset(0f);
    xAxis.setXOffset(0f);
    xAxis.setValueFormatter(formatter);
    xAxis.setTextColor(Color.WHITE);

    YAxis yAxis = mRadarChart.getYAxis();
    yAxis.setLabelCount(5, false);
    yAxis.setTextSize(9f);
    yAxis.setAxisMinimum(0f);
    yAxis.setAxisMaximum(yAxisMaxValue);
    yAxis.setDrawLabels(false);

    Legend l = mRadarChart.getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
    l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
    l.setDrawInside(false);
    l.setXEntrySpace(7f);
    l.setYEntrySpace(5f);
    l.setTextColor(Color.WHITE);
}
 
开发者ID:Alex-ZHOU,项目名称:VMAndroid,代码行数:27,代码来源:AnalysisFragment.java

示例4: setup

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
/**
 * 设置字体
 *
 * @param chart
 */
protected void setup(Chart<?> chart) {
    mTy = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
    chart.setDescription("");
    chart.setNoDataTextDescription("You need to provide data for the chart.");
    chart.setTouchEnabled(true);
    if (chart instanceof BarLineChartBase) {
        BarLineChartBase mChart = (BarLineChartBase) chart;
        mChart.setDrawGridBackground(false);
        mChart.setDragEnabled(true);
        mChart.setScaleEnabled(true);
        mChart.setPinchZoom(false);
        YAxis leftAxis = mChart.getAxisLeft();
        leftAxis.removeAllLimitLines(); // reset all limit lines to avoid overlapping lines
        leftAxis.setTypeface(mTy);
        leftAxis.setTextSize(8f);
        leftAxis.setTextColor(Color.WHITE);
        XAxis xAxis = mChart.getXAxis();
        xAxis.setLabelRotationAngle(-50);//设置x轴字体显示角度
        xAxis.setTypeface(mTy);
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        xAxis.setTextSize(8f);
        xAxis.setTextColor(Color.WHITE);
        mChart.getAxisRight().setEnabled(false);
    }
}
 
开发者ID:dscn,项目名称:ktball,代码行数:31,代码来源:SchoolAllPeopleDetailAcitivty.java

示例5: setXlabels

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
private void setXlabels(List<String> labelList)
{
    int valuesSelectedItemPos = cache.getValuesSpinner().getSelectedItemPosition();
    String[] labels = new String[ labelList.size() ];
    labelList.toArray(labels);

    PFAXAxisLabels xFormatter = new PFAXAxisLabels(labels);
    chart.setMarkerView(new PFAMarkerView(context, xFormatter, valuesSelectedItemPos, cache.getNumberScale()));

    XAxis xAxis = chart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setDrawGridLines(false);
    xAxis.setGranularity(1f);
    xAxis.setLabelCount(5);
    xAxis.setValueFormatter(xFormatter);
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-shopping-list,代码行数:17,代码来源:PFAChart.java

示例6: setChartOptions

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
private void setChartOptions() {
    mChart.getLegend().setEnabled(false);
    mChart.setAutoScaleMinMaxEnabled(true);
    mChart.setScaleYEnabled(false);
    mChart.setDescription(null);
    mChart.setDrawGridBackground(false);
    mChart.setDrawBorders(false);
    mChart.setHighlightPerTapEnabled(false);
    mChart.setHighlightPerDragEnabled(false);

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

    IAxisValueFormatter xAxisFormatter = new HourAxisValueFormatter();
    XAxis xAxis = mChart.getXAxis();
    xAxis.setValueFormatter(xAxisFormatter);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE);
}
 
开发者ID:AIDEA775,项目名称:UNCmorfi,代码行数:19,代码来源:CounterFragment.java

示例7: initializeChart

import com.github.mikephil.charting.components.XAxis; //导入依赖的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

示例8: initTemperatureChart

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
private void initTemperatureChart() {
    m_barChart.setDrawBarShadow(false);
    m_barChart.setDrawValueAboveBar(true);

    m_barChart.setDescription("");
    m_barChart.setDrawBarShadow(false);

    m_barChart.setDrawGridBackground(false);
    m_barChart.setTouchEnabled(false);
    m_barChart.setScaleXEnabled(false);
    m_barChart.setScaleYEnabled(false);

    XAxis xAxis = m_barChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setDrawGridLines(false);
    xAxis.setSpaceBetweenLabels(1);

    Legend l = m_barChart.getLegend();
    l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);
    l.setForm(Legend.LegendForm.SQUARE);
    l.setFormSize(9f);
    l.setTextSize(11f);
    l.setXEntrySpace(4f);
}
 
开发者ID:ChanJLee,项目名称:YunShuWeather,代码行数:25,代码来源:WeatherForecastActivity.java

示例9: chartStyling

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void chartStyling(LineChart chart) {
    chart.setTouchEnabled(false);
    chart.setDescription("");
    chart.setAutoScaleMinMaxEnabled(false);
    chart.setNoDataTextColor(SettingsActivity.ThemePreferenceFragment.isLight(getContext()) ? Color.BLACK : Color.WHITE);
    YAxis axisRight = chart.getAxisRight();
    axisRight.setEnabled(false);
    chart.getLegend().setEnabled(false);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        chart.setNestedScrollingEnabled(false);
    }

    XAxis xAxis = chart.getXAxis();
    chartXAxisStyling(xAxis);
    YAxis yAxis = chart.getAxisLeft();
    chartYAxisStyling(yAxis);
}
 
开发者ID:DmitryMalkovich,项目名称:gito-github-client,代码行数:19,代码来源:TrafficFragment.java

示例10: setXAxis

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
/**
 * xAxis config details: https://github.com/PhilJay/MPAndroidChart/wiki/XAxis
 */
@ReactProp(name = "xAxis")
public void setXAxis(Chart chart, ReadableMap propMap) {
    XAxis axis = chart.getXAxis();

    setCommonAxisConfig(chart, axis, propMap);

    if (BridgeUtils.validate(propMap, ReadableType.Number, "labelsToSkip")) {
        axis.setLabelsToSkip(propMap.getInt("labelsToSkip"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Boolean, "avoidFirstLastClipping")) {
        axis.setAvoidFirstLastClipping(propMap.getBoolean("avoidFirstLastClipping"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "spaceBetweenLabels")) {
        axis.setSpaceBetweenLabels(propMap.getInt("spaceBetweenLabels"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.String, "position")) {
        axis.setPosition(XAxisPosition.valueOf(propMap.getString("position")));
    }
}
 
开发者ID:mskec,项目名称:react-native-mp-android-chart,代码行数:23,代码来源:ChartBaseManager.java

示例11: XAxisRenderer

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
public XAxisRenderer(ViewPortHandler viewPortHandler, XAxis xAxis, Transformer trans) {
    super(viewPortHandler, trans, xAxis);

    this.mXAxis = xAxis;

    mAxisLabelPaint.setColor(Color.BLACK);
    mAxisLabelPaint.setTextAlign(Align.CENTER);
    mAxisLabelPaint.setTextSize(Utils.convertDpToPixel(10f));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:XAxisRenderer.java

示例12: onCreateView

import com.github.mikephil.charting.components.XAxis; //导入依赖的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

示例13: onCreateView

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.frag_simple_scatter, container, false);
    
    mChart = (ScatterChart) v.findViewById(R.id.scatterChart1);
    mChart.getDescription().setEnabled(false);
    
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
    
    MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
    mv.setChartView(mChart); // For bounds control
    mChart.setMarker(mv);

    mChart.setDrawGridBackground(false);
    mChart.setData(generateScatterData(6, 10000, 200));
    
    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(true);
    xAxis.setPosition(XAxisPosition.BOTTOM);
    
    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(tf);
    
    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setTypeface(tf);
    rightAxis.setDrawGridLines(false);
    
    Legend l = mChart.getLegend();
    l.setWordWrapEnabled(true);
    l.setTypeface(tf);
    l.setFormSize(14f);
    l.setTextSize(9f);
    
    // increase the space between legend & bottom and legend & content
    l.setYOffset(13f);       
    mChart.setExtraBottomOffset(16f);
    
    return v;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:ScatterChartFrag.java

示例14: onCreate

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_linechart_noseekbar);

    mChart = (LineChart) findViewById(R.id.chart1);
    mChart.setBackgroundColor(Color.WHITE);
    mChart.setGridBackgroundColor(mFillColor);
    mChart.setDrawGridBackground(true);

    mChart.setDrawBorders(true);

    // no description text
    mChart.getDescription().setEnabled(false);

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

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

    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(false);

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setAxisMaximum(900f);
    leftAxis.setAxisMinimum(-250f);
    leftAxis.setDrawAxisLine(false);
    leftAxis.setDrawZeroLine(false);
    leftAxis.setDrawGridLines(false);

    mChart.getAxisRight().setEnabled(false);

    // add data
    setData(100, 60);

    mChart.invalidate();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:41,代码来源:FilledLineActivity.java

示例15: onCreate

import com.github.mikephil.charting.components.XAxis; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_draw_chart);

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

    // listener for selecting and drawing
    mChart.setOnChartValueSelectedListener(this);
    mChart.setOnDrawListener(this);

    // if disabled, drawn datasets with the finger will not be automatically
    // finished
    // mChart.setAutoFinish(true);
    mChart.setDrawGridBackground(false);

    // add dummy-data to the chart
    initWithDummyData();

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

    XAxis xl = mChart.getXAxis();
    xl.setTypeface(tf);
    xl.setAvoidFirstLastClipping(true);

    YAxis yl = mChart.getAxisLeft();
    yl.setTypeface(tf);

    mChart.getLegend().setEnabled(false);

    // mChart.setYRange(-40f, 40f, true);
    // call this to reset the changed y-range
    // mChart.resetYRange(true);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:DrawChartActivity.java


注:本文中的com.github.mikephil.charting.components.XAxis类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。