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


Java Description.setTextSize方法代码示例

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


在下文中一共展示了Description.setTextSize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareLegend

import com.github.mikephil.charting.components.Description; //导入方法依赖的package包/类
/**
 * Create a legend based on a dummy chart.  The legend
 * is used by all charts and is positioned
 * across the top of the screen.
 * @param data - CombinedData used to generate the legend
 */
private void prepareLegend(final CombinedData data){
  //The dummy chart is never shown, but it's legend is.
  final CombinedChart dummyChart = (CombinedChart) mRoot.findViewById(R.id.legend);
  dummyChart.getPaint(Chart.PAINT_DESCRIPTION).setTextAlign(Paint.Align.CENTER);
  dummyChart.getXAxis().setEnabled(false);
  dummyChart.getAxisRight().setEnabled(false);
  dummyChart.getAxisLeft().setEnabled(false);
  final Description description = new Description();
  description.setText("");
  description.setTextSize(10f);
  dummyChart.setDescription(description);
  dummyChart.setBackgroundColor(Color.WHITE);
  dummyChart.setDrawGridBackground(false);
  dummyChart.setData(data);

  final Legend l = dummyChart.getLegend();
  l.setEnabled(true);
  // The positioning of the legend effectively
  // hides the dummy chart from view.
  l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
  l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
  dummyChart.invalidate();
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:30,代码来源:SummaryChartFragment.java

示例2: drawLatencyChart

import com.github.mikephil.charting.components.Description; //导入方法依赖的package包/类
private void drawLatencyChart(List<Entry> phoneEntriesShifted, List<Entry> waltEntries) {
    final ScatterDataSet dataSetWalt =
            new ScatterDataSet(waltEntries, "WALT Events");
    dataSetWalt.setColor(Color.BLUE);
    dataSetWalt.setScatterShape(ScatterChart.ScatterShape.CIRCLE);
    dataSetWalt.setScatterShapeSize(8f);

    final ScatterDataSet dataSetPhoneShifted =
            new ScatterDataSet(phoneEntriesShifted, "Phone Events Shifted");
    dataSetPhoneShifted.setColor(Color.RED);
    dataSetPhoneShifted.setScatterShapeSize(10f);
    dataSetPhoneShifted.setScatterShape(ScatterChart.ScatterShape.X);

    final ScatterData scatterData = new ScatterData(dataSetWalt, dataSetPhoneShifted);
    final Description desc = new Description();
    desc.setText("");
    desc.setTextSize(12f);
    latencyChart.setDescription(desc);
    latencyChart.setData(scatterData);
    latencyChart.invalidate();
    latencyChartLayout.setVisibility(View.VISIBLE);
}
 
开发者ID:google,项目名称:walt,代码行数:23,代码来源:AccelerometerFragment.java

示例3: showChart

import com.github.mikephil.charting.components.Description; //导入方法依赖的package包/类
/**
 * Display the chart view
 */
private void showChart(){
  final String [] labels = mData.getDataSetLabels();
  String property = mData.getDataSetLabels()[labels.length -1];

  mChart.setData(mData);
  mChart.getAxisLeft().setInverted(true);
  mChart.getXAxis().setEnabled(true);
  mChart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);

  mChart.getXAxis().setAxisMinimum(mData.getXMin()-1);
  mChart.getXAxis().setAxisMaximum(mData.getXMax() + 1);
  mChart.getAxisRight().setEnabled(false);
  mChart.getAxisLeft().setDrawGridLines(true);
  mChart.setDrawGridBackground(true);
  final Description description = new Description();
  description.setText("");
  description.setTextSize(10f);
  mChart.setDescription(description);
  mChart.getLegend().setEnabled(false);

  mChart.invalidate();
  if (property.equalsIgnoreCase("TEMPERATURE")){
    property = property + " \u2103";
  }else if (property.equalsIgnoreCase("SALINITY")){
    property = property + " ppm";
  }else{
    property = property + " \u00b5" + "m/L";
  }
  mTxtXAxisTitle.setText(property);
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:34,代码来源:ChartFragment.java

示例4: drawLatencyGraph

import com.github.mikephil.charting.components.Description; //导入方法依赖的package包/类
private void drawLatencyGraph(double[] ft, double[] fy, double[] lt, double averageBestShift) {
    final ArrayList<Entry> touchEntries = new ArrayList<>();
    final ArrayList<Entry> laserEntries = new ArrayList<>();
    final double[] laserT = new double[lt.length];
    for (int i = 0; i < ft.length; i++) {
        touchEntries.add(new Entry((float) ft[i], (float) fy[i]));
    }
    for (int i = 0; i < lt.length; i++) {
        laserT[i] = lt[i] + averageBestShift;
    }
    final double[] laserY = Utils.interp(laserT, ft, fy);
    for (int i = 0; i < laserY.length; i++) {
        laserEntries.add(new Entry((float) laserT[i], (float) laserY[i]));
    }

    final ScatterDataSet dataSetTouch = new ScatterDataSet(touchEntries, "Touch Events");
    dataSetTouch.setScatterShape(ScatterChart.ScatterShape.CIRCLE);
    dataSetTouch.setScatterShapeSize(8f);

    final ScatterDataSet dataSetLaser = new ScatterDataSet(laserEntries,
            String.format(Locale.US, "Laser Events  Latency=%.1f ms", averageBestShift));
    dataSetLaser.setColor(Color.RED);
    dataSetLaser.setScatterShapeSize(10f);
    dataSetLaser.setScatterShape(ScatterChart.ScatterShape.X);

    final ScatterData scatterData = new ScatterData(dataSetTouch, dataSetLaser);
    final Description desc = new Description();
    desc.setText("Y-Position [pixels] vs. Time [ms]");
    desc.setTextSize(12f);
    latencyChart.setDescription(desc);
    latencyChart.setData(scatterData);
    latencyChartLayout.setVisibility(View.VISIBLE);
}
 
开发者ID:google,项目名称:walt,代码行数:34,代码来源:DragLatencyFragment.java

示例5: drawBrightnessChart

import com.github.mikephil.charting.components.Description; //导入方法依赖的package包/类
private void drawBrightnessChart() {
    final String brightnessCurveString = brightnessCurveData.toString();
    List<Entry> entries = new ArrayList<>();

    // "u" marks the start of the brightness curve data
    int startIndex = brightnessCurveString.indexOf("u") + 1;
    int endIndex = brightnessCurveString.indexOf("end");
    if (endIndex == -1) endIndex = brightnessCurveString.length();

    String[] brightnessStrings =
            brightnessCurveString.substring(startIndex, endIndex).trim().split("\n");
    for (String str : brightnessStrings) {
        String[] arr = str.split(" ");
        final float timestampMs = Integer.parseInt(arr[0]) / 1000f;
        final float brightness = Integer.parseInt(arr[1]);
        entries.add(new Entry(timestampMs, brightness));
    }
    LineDataSet dataSet = new LineDataSet(entries, "Brightness");
    dataSet.setColor(Color.BLACK);
    dataSet.setValueTextColor(Color.BLACK);
    dataSet.setCircleColor(Color.BLACK);
    dataSet.setCircleRadius(1.5f);
    dataSet.setCircleColorHole(Color.DKGRAY);
    LineData lineData = new LineData(dataSet);
    brightnessChart.setData(lineData);
    final Description desc = new Description();
    desc.setText("Screen Brightness [digital level 0-1023] vs. Time [ms]");
    desc.setTextSize(12f);
    brightnessChart.setDescription(desc);
    brightnessChart.getLegend().setEnabled(false);
    brightnessChart.invalidate();
    brightnessChartLayout.setVisibility(View.VISIBLE);
}
 
开发者ID:google,项目名称:walt,代码行数:34,代码来源:ScreenResponseFragment.java

示例6: drawWaveformChart

import com.github.mikephil.charting.components.Description; //导入方法依赖的package包/类
private void drawWaveformChart() {
    final short[] wave = AudioTest.getRecordedWave();
    List<Entry> entries = new ArrayList<>();
    int frameRate = audioTest.getOptimalFrameRate();
    for (int i = 0; i < wave.length; i++) {
        float timeStamp = (float) i / frameRate * 1000f;
        entries.add(new Entry(timeStamp, (float) wave[i]));
    }
    LineDataSet dataSet = new LineDataSet(entries, "Waveform");
    dataSet.setColor(Color.BLACK);
    dataSet.setValueTextColor(Color.BLACK);
    dataSet.setCircleColor(ContextCompat.getColor(getContext(), R.color.DarkGreen));
    dataSet.setCircleRadius(1.5f);
    dataSet.setCircleColorHole(Color.DKGRAY);
    LineData lineData = new LineData(dataSet);
    chart.setData(lineData);

    LimitLine line = new LimitLine(audioTest.getThreshold(), "Threshold");
    line.setLineColor(Color.RED);
    line.setLabelPosition(LimitLine.LimitLabelPosition.LEFT_TOP);
    line.setLineWidth(2f);
    line.setTextColor(Color.DKGRAY);
    line.setTextSize(10f);
    chart.getAxisLeft().addLimitLine(line);

    final Description desc = new Description();
    desc.setText("Wave [digital level -32768 to +32767] vs. Time [ms]");
    desc.setTextSize(12f);
    chart.setDescription(desc);
    chart.getLegend().setEnabled(false);
    chart.invalidate();
    chartLayout.setVisibility(View.VISIBLE);
}
 
开发者ID:google,项目名称:walt,代码行数:34,代码来源:AudioFragment.java

示例7: showFeedback

import com.github.mikephil.charting.components.Description; //导入方法依赖的package包/类
@Override
public void showFeedback(Feedback feedbackToShow) {

    final List<PieEntry> entries = new ArrayList<>();
    final List<Integer> colors = new ArrayList<>();
    if (feedbackToShow.getStar4() > 0) {
        entries.add(new PieEntry(feedbackToShow.getStar4(), "Super happy"));
        colors.add(ContextCompat.getColor(this, R.color.super_happy));
    }
    if (feedbackToShow.getStar3() > 0) {
        entries.add(new PieEntry(feedbackToShow.getStar3(), "Happy"));
        colors.add(ContextCompat.getColor(this, R.color.happy));
    }
    if (feedbackToShow.getStar2() > 0) {
        entries.add(new PieEntry(feedbackToShow.getStar2(), "Meh"));
        colors.add(ContextCompat.getColor(this, R.color.meh));
    }
    if (feedbackToShow.getStar1() > 0) {
        entries.add(new PieEntry(feedbackToShow.getStar1(), "Sad"));
        colors.add(ContextCompat.getColor(this, R.color.sad));
    }
    final PieDataSet pieDataSet = new PieDataSet(entries, null);
    pieDataSet.setValueTextSize(20f);
    pieDataSet.setColors(colors);
    final PieData pieData = new PieData(pieDataSet);
    pieData.setValueFormatter(new PercentFormatter());
    pieData.setValueTextSize(16f);
    pieChart.setData(pieData);
    final Description description = new Description();
    description.setTextSize(16f);
    description.setText("Total votes: " + feedbackToShow.getTotal());
    pieChart.setDescription(description);
    pieChart.setCenterText(feedbackToShow.getQuestion().getText());
    pieChart.setCenterTextSize(20f);
    pieChart.setCenterTextRadiusPercent(90f);
    pieChart.setUsePercentValues(true);
    pieChart.setEntryLabelTextSize(16f);

    //Init entries:
    final Legend l = pieChart.getLegend();
    l.setEntries(Collections.emptyList());
    pieChart.invalidate();
}
 
开发者ID:ZelsinkiHackWeek,项目名称:howislife,代码行数:44,代码来源:StatisticsActivity.java

示例8: HistogramChart

import com.github.mikephil.charting.components.Description; //导入方法依赖的package包/类
public HistogramChart(Context context, AttributeSet attrs) {
    super(context, attrs);
    inflate(getContext(), R.layout.histogram, this);

    barChart = (BarChart) findViewById(R.id.bar_chart);
    findViewById(R.id.button_close_bar_chart).setOnClickListener(this);

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HistogramChart);
    final String descString;
    final int numDataSets;
    final float binWidth;
    try {
        descString = a.getString(R.styleable.HistogramChart_description);
        numDataSets = a.getInteger(R.styleable.HistogramChart_numDataSets, 1);
        binWidth = a.getFloat(R.styleable.HistogramChart_binWidth, 5f);
    } finally {
        a.recycle();
    }

    ArrayList<IBarDataSet> dataSets = new ArrayList<>(numDataSets);
    for (int i = 0; i < numDataSets; i++) {
        final BarDataSet dataSet = new BarDataSet(new ArrayList<BarEntry>(), "");
        dataSet.setColor(ColorTemplate.MATERIAL_COLORS[i]);
        dataSets.add(dataSet);
    }

    BarData barData = new BarData(dataSets);
    barData.setBarWidth((1f - GROUP_SPACE)/numDataSets);
    barChart.setData(barData);
    histogramData = new HistogramData(numDataSets, binWidth);
    groupBars(barData);
    final Description desc = new Description();
    desc.setText(descString);
    desc.setTextSize(12f);
    barChart.setDescription(desc);

    XAxis xAxis = barChart.getXAxis();
    xAxis.setGranularityEnabled(true);
    xAxis.setGranularity(1);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setValueFormatter(new IAxisValueFormatter() {
        DecimalFormat df = new DecimalFormat("#.##");

        @Override
        public String getFormattedValue(float value, AxisBase axis) {
            return df.format(histogramData.getDisplayValue(value));
        }
    });

    barChart.setFitBars(true);
    barChart.invalidate();
}
 
开发者ID:google,项目名称:walt,代码行数:53,代码来源:HistogramChart.java


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