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


Java ZoomType类代码示例

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


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

示例1: onCreateView

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    binding = FragmentStatisticsChartConsumptionPreviewBinding.inflate(inflater);

    chart = binding.chart;
    previewChart = binding.chartPreview;
    chart.setZoomEnabled(true);
    chart.setScrollEnabled(true);
    chart.setZoomType(ZoomType.HORIZONTAL);
    chart.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL);
    chart.setViewportChangeListener(new ViewportListener());
    chart.setOnValueTouchListener(new ValueTouchListener());
    previewChart.setScrollEnabled(false);
    previewChart.setZoomEnabled(false);

    return binding.getRoot();
}
 
开发者ID:piskula,项目名称:FuelUp,代码行数:18,代码来源:StatisticsChartConsumptionPreviewFragment.java

示例2: setupCharts

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
private void setupCharts() {
    dateButton1.setText(dateFormatter.format(date1.getTime()));

    Calendar endDate = (GregorianCalendar) date1.clone();
    endDate.add(Calendar.DATE, noDays);
    int numValues = noDays * (60 / 2) * 24; // LimiTTer sample rate 1 per 2 minutes
    BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(this, date1.getTimeInMillis(), endDate.getTimeInMillis(), numValues, false);

    chart = (LineChartView) findViewById(R.id.chart);
    chart.setZoomType(ZoomType.HORIZONTAL);
    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    chart.setOnValueTouchListener(bgGraphBuilder.getOnValueSelectTooltipListener(this));
    previewChart.setLineChartData(bgGraphBuilder.previewLineData(chart.getLineChartData()));

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());

    setupStatistics(date1.getTimeInMillis(), endDate.getTimeInMillis());
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:25,代码来源:BGHistory.java

示例3: setupCharts

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
private void setupCharts() {
    dateButton1.setText(dateFormatter.format(date1.getTime()));

    Calendar endDate = (GregorianCalendar) date1.clone();
    endDate.add(Calendar.DATE, noDays);
    int numValues = noDays * (60 / 5) * 24;
    BgGraphBuilder bgGraphBuilder = new BgGraphBuilder(this, date1.getTimeInMillis(), endDate.getTimeInMillis(), numValues);

    chart = (LineChartView) findViewById(R.id.chart);
    chart.setZoomType(ZoomType.HORIZONTAL);
    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    chart.setOnValueTouchListener(bgGraphBuilder.getOnValueSelectTooltipListener());
    previewChart.setLineChartData(bgGraphBuilder.previewLineData());

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());
}
 
开发者ID:StephenBlackWasAlreadyTaken,项目名称:xDrip-Experimental,代码行数:23,代码来源:BGHistory.java

示例4: setupCharts

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
public void setupCharts() {
    bgGraphBuilder  = new BgGraphBuilder(this);
    updateStuff = false;
    chart = (LineChartView) findViewById(R.id.chart);
    chart.setZoomType(ZoomType.HORIZONTAL);

    previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview);
    previewChart.setZoomType(ZoomType.HORIZONTAL);

    chart.setLineChartData(bgGraphBuilder.lineData());
    previewChart.setLineChartData(bgGraphBuilder.previewLineData());
    updateStuff = true;

    previewChart.setViewportCalculationEnabled(true);
    chart.setViewportCalculationEnabled(true);
    previewChart.setViewportChangeListener(new ViewportListener());
    chart.setViewportChangeListener(new ChartViewPortListener());
    setViewport();
}
 
开发者ID:StephenBlackWasAlreadyTaken,项目名称:NightWatch,代码行数:20,代码来源:Home.java

示例5: onPostExecute

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
@Override
protected void onPostExecute(ArrayList<LineChartData> result) {
    //Write some code you want to execute on UI after doInBackground() completes
    bgChartLoading.setVisibility(View.GONE);
    //bgChart.setVisibility(View.VISIBLE);

    bgChart.setLineChartData(result.get(0));
    bgPreviewChart.setLineChartData(result.get(1));
    updateStuff = true;

    //refreshes data and sets viewpoint
    bgChart.setZoomType(ZoomType.HORIZONTAL);
    bgPreviewChart.setZoomType(ZoomType.HORIZONTAL);
    bgPreviewChart.setViewportCalculationEnabled(true);
    bgChart.setViewportCalculationEnabled(true);
    bgPreviewChart.setViewportChangeListener(new ViewportListener());
    bgChart.setViewportChangeListener(new ChartViewPortListener());

    setViewport();

    Log.d(TAG, "bgGraph Updated");
}
 
开发者ID:timomer,项目名称:HAPP,代码行数:23,代码来源:MainActivity.java

示例6: setupChart

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
private static void setupChart(Context context, ColumnChartView chart, List<AxisValue> xAxisValues, String yAxisLabel, List<Column> columns) {
    Axis xAxis = new Axis(xAxisValues);
    ChartUtils.setupXAxis(context, xAxis);
    Axis yAxis = new Axis();
    ChartUtils.setupYAxis(context, yAxisLabel, yAxis);
    ColumnChartData data = new ColumnChartData();
    data.setAxisXBottom(xAxis);
    data.setAxisYLeft(yAxis);
    data.setColumns(columns);
    data.setStacked(true);
    chart.setInteractive(true);
    chart.setColumnChartData(data);
    chart.setValueSelectionEnabled(true);
    chart.setZoomEnabled(true);
    chart.setZoomType(ZoomType.HORIZONTAL);
    WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    DisplayMetrics displayMetrics = new DisplayMetrics();
    windowManager.getDefaultDisplay().getMetrics(displayMetrics);
    float numberVisibleColumns = displayMetrics.widthPixels / context.getResources().getDimension(R.dimen.column_chart_column_width);
    float zoomLevel = columns.size() / numberVisibleColumns;
    if (zoomLevel > 0) {
        chart.setZoomLevel(chart.getMaximumViewport().right - 1, 0.0f, zoomLevel);
    }
}
 
开发者ID:caarmen,项目名称:scrumchatter,代码行数:25,代码来源:MemberSpeakingTimeColumnChart.java

示例7: onOptionsItemSelected

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_reset) {
        generateDefaultData();
        chart.setColumnChartData(data);
        previewChart.setColumnChartData(previewData);
        previewX(true);
        return true;
    }
    if (id == R.id.action_preview_both) {
        previewXY();
        previewChart.setZoomType(ZoomType.HORIZONTAL_AND_VERTICAL);
        return true;
    }
    if (id == R.id.action_preview_horizontal) {
        previewX(true);
        return true;
    }
    if (id == R.id.action_preview_vertical) {
        previewY();
        return true;
    }
    if (id == R.id.action_change_color) {
        int color = ChartUtils.pickColor();
        while (color == previewChart.getPreviewColor()) {
            color = ChartUtils.pickColor();
        }
        previewChart.setPreviewColor(color);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:34,代码来源:PreviewColumnChartActivity.java

示例8: previewY

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
private void previewY() {
    Viewport tempViewport = new Viewport(chart.getMaximumViewport());
    float dy = tempViewport.height() / 4;
    tempViewport.inset(0, dy);
    previewChart.setCurrentViewportWithAnimation(tempViewport);
    previewChart.setZoomType(ZoomType.VERTICAL);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:PreviewColumnChartActivity.java

示例9: previewX

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
private void previewX(boolean animate) {
    Viewport tempViewport = new Viewport(chart.getMaximumViewport());
    float dx = tempViewport.width() / 4;
    tempViewport.inset(dx, 0);
    if (animate) {
        previewChart.setCurrentViewportWithAnimation(tempViewport);
    } else {
        previewChart.setCurrentViewport(tempViewport);
    }
    previewChart.setZoomType(ZoomType.HORIZONTAL);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:PreviewColumnChartActivity.java

示例10: generateInitialLineData

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
/**
 * Generates initial data for line chart. At the begining all Y values are equals 0. That will change when user
 * will select value on column chart.
 */
private void generateInitialLineData() {
    int numValues = 7;

    List<AxisValue> axisValues = new ArrayList<AxisValue>();
    List<PointValue> values = new ArrayList<PointValue>();
    for (int i = 0; i < numValues; ++i) {
        values.add(new PointValue(i, 0));
        axisValues.add(new AxisValue(i).setLabel(days[i]));
    }

    Line line = new Line(values);
    line.setColor(ChartUtils.COLOR_GREEN).setCubic(true);

    List<Line> lines = new ArrayList<Line>();
    lines.add(line);

    lineData = new LineChartData(lines);
    lineData.setAxisXBottom(new Axis(axisValues).setHasLines(true));
    lineData.setAxisYLeft(new Axis().setHasLines(true).setMaxLabelChars(3));

    chartTop.setLineChartData(lineData);

    // For build-up animation you have to disable viewport recalculation.
    chartTop.setViewportCalculationEnabled(false);

    // And set initial max viewport and current viewport- remember to set viewports after data.
    Viewport v = new Viewport(0, 110, 6, 0);
    chartTop.setMaximumViewport(v);
    chartTop.setCurrentViewport(v);

    chartTop.setZoomType(ZoomType.HORIZONTAL);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:LineColumnDependencyActivity.java

示例11: onOptionsItemSelected

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_reset) {
        generateDefaultData();
        chart.setLineChartData(data);
        previewChart.setLineChartData(previewData);
        previewX(true);
        return true;
    }
    if (id == R.id.action_preview_both) {
        previewXY();
        previewChart.setZoomType(ZoomType.HORIZONTAL_AND_VERTICAL);
        return true;
    }
    if (id == R.id.action_preview_horizontal) {
        previewX(true);
        return true;
    }
    if (id == R.id.action_preview_vertical) {
        previewY();
        return true;
    }
    if (id == R.id.action_change_color) {
        int color = ChartUtils.pickColor();
        while (color == previewChart.getPreviewColor()) {
            color = ChartUtils.pickColor();
        }
        previewChart.setPreviewColor(color);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:34,代码来源:PreviewLineChartActivity.java

示例12: onCreateView

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    binding = FragmentStatisticsChartCostsPerTimeBinding.inflate(inflater);

    vehicle = getArguments().getParcelable(ARG_VEHICLE);

    chart = binding.chart;
    chart.setZoomEnabled(true);
    chart.setScrollEnabled(true);
    chart.setZoomType(ZoomType.HORIZONTAL);
    chart.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL);
    chart.setOnValueTouchListener(new ValueTouchListener());

    return binding.getRoot();
}
 
开发者ID:piskula,项目名称:FuelUp,代码行数:16,代码来源:StatisticsChartCostsPerTimeFragment.java

示例13: onCreateView

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    binding = FragmentStatisticsChartConsumptionPerTimeBinding.inflate(inflater);

    chart = binding.chart;
    chart.setZoomEnabled(true);
    chart.setScrollEnabled(true);
    chart.setZoomType(ZoomType.HORIZONTAL);
    chart.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL);

    return binding.getRoot();
}
 
开发者ID:piskula,项目名称:FuelUp,代码行数:13,代码来源:StatisticsChartConsumptionPerTimeFragment.java

示例14: setInitialLineDatas

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
public void setInitialLineDatas(){
    int numValues = 7;                      //7个值 注意与定义的X轴数量相同

    List<AxisValue> axisValues = new ArrayList<>();
    List<PointValue> values = new ArrayList<>();

    //设置默认值 都为0
    for (int i = 0; i < numValues; ++i) {
        values.add(new PointValue(i, 0));
        axisValues.add(new AxisValue(i).setLabel(dayStrs[i]));
    }

    //设置线
    Line line = new Line(values);
    line.setColor(ChartUtils.COLOR_GREEN).setCubic(true);

    List<Line> lines = new ArrayList<>();
    lines.add(line);

    //对数据进行一些设置 类似Line Chart
    mLineData = new LineChartData(lines);
    mLineData.setAxisXBottom(new Axis(axisValues).setHasLines(true));
    mLineData.setAxisYLeft(new Axis().setHasLines(true).setMaxLabelChars(3));
    mLineView.setLineChartData(mLineData);
    mLineView.setViewportCalculationEnabled(false);

    //设置到窗口上
    Viewport v = new Viewport(0, 110, 6, -5);   //防止曲线超过范围 边界保护
    mLineView.setMaximumViewport(v);
    mLineView.setCurrentViewport(v);
    mLineView.setZoomType(ZoomType.HORIZONTAL);
}
 
开发者ID:lupwei,项目名称:Croprotector,代码行数:33,代码来源:disease_num_chart_fragment.java

示例15: onViewportChanged

import lecho.lib.hellocharts.gesture.ZoomType; //导入依赖的package包/类
@Override
public synchronized void onViewportChanged(Viewport newViewport) {
    if (!updatingPreviewViewport) {
        updatingChartViewport = true;
        previewChart.setZoomType(ZoomType.HORIZONTAL);
        previewChart.setCurrentViewport(newViewport);
        updatingChartViewport = false;
    }
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:10,代码来源:Home.java


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