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


Java ColumnChartData类代码示例

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


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

示例1: calculateMaxViewportForStacked

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
private void calculateMaxViewportForStacked(ColumnChartData data) {
    for (Column column : data.getColumns()) {
        float sumPositive = baseValue;
        float sumNegative = baseValue;
        for (SubcolumnValue columnValue : column.getValues()) {
            if (columnValue.getValue() >= baseValue) {
                sumPositive += columnValue.getValue();
            } else {
                sumNegative += columnValue.getValue();
            }
        }
        if (sumPositive > tempMaximumViewport.top) {
            tempMaximumViewport.top = sumPositive;
        }
        if (sumNegative < tempMaximumViewport.bottom) {
            tempMaximumViewport.bottom = sumNegative;
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:ColumnChartRenderer.java

示例2: generateDefaultData

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
private void generateDefaultData() {
    int numSubcolumns = 1;
    int numColumns = 50;
    List<Column> columns = new ArrayList<Column>();
    List<SubcolumnValue> values;
    for (int i = 0; i < numColumns; ++i) {

        values = new ArrayList<SubcolumnValue>();
        for (int j = 0; j < numSubcolumns; ++j) {
            values.add(new SubcolumnValue((float) Math.random() * 50f + 5, ChartUtils.pickColor()));
        }

        columns.add(new Column(values));
    }

    data = new ColumnChartData(columns);
    data.setAxisXBottom(new Axis());
    data.setAxisYLeft(new Axis().setHasLines(true));

    // prepare preview data, is better to use separate deep copy for preview chart.
    // set color to grey to make preview area more visible.
    previewData = new ColumnChartData(data);
    for (Column column : previewData.getColumns()) {
        for (SubcolumnValue value : column.getValues()) {
            value.setColor(ChartUtils.DEFAULT_DARKEN_COLOR);
        }
    }

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:PreviewColumnChartActivity.java

示例3: generateColumnChartData

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
private ColumnChartData generateColumnChartData() {
    int numSubcolumns = 1;
    int numColumns = 12;
    // Column can have many subcolumns, here by default I use 1 subcolumn in each of 8 columns.
    List<Column> columns = new ArrayList<Column>();
    List<SubcolumnValue> values;
    for (int i = 0; i < numColumns; ++i) {

        values = new ArrayList<SubcolumnValue>();
        for (int j = 0; j < numSubcolumns; ++j) {
            values.add(new SubcolumnValue((float) Math.random() * 50f + 5, ChartUtils.pickColor()));
        }

        columns.add(new Column(values));
    }

    ColumnChartData data = new ColumnChartData(columns);

    data.setAxisXBottom(new Axis().setName("Axis X"));
    data.setAxisYLeft(new Axis().setName("Axis Y").setHasLines(true));
    return data;

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:ViewPagerChartsActivity.java

示例4: generateColumnData

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
private ColumnChartData generateColumnData() {
    int numSubcolumns = 1;
    int numColumns = 12;
    // Column can have many subcolumns, here by default I use 1 subcolumn in each of 8 columns.
    List<Column> columns = new ArrayList<Column>();
    List<SubcolumnValue> values;
    for (int i = 0; i < numColumns; ++i) {

        values = new ArrayList<SubcolumnValue>();
        for (int j = 0; j < numSubcolumns; ++j) {
            values.add(new SubcolumnValue((float) Math.random() * 50 + 5, ChartUtils.COLOR_GREEN));
        }

        columns.add(new Column(values));
    }

    ColumnChartData columnChartData = new ColumnChartData(columns);
    return columnChartData;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:ComboLineColumnChartActivity.java

示例5: removeMargins

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
public void removeMargins() {
    Rect contentRect = this.computator.getContentRectMinusAllMargins();
    if (contentRect.height() != 0 && contentRect.width() != 0) {
        float pxX = this.computator.computeRawDistanceX(this.maxRadius * this.bubbleScaleX);
        float pxY = this.computator.computeRawDistanceY(this.maxRadius * this.bubbleScaleY);
        float scaleX = this.computator.getMaximumViewport().width() / ((float) contentRect.width());
        float scaleY = this.computator.getMaximumViewport().height() / ((float) contentRect.height());
        float dx = 0.0f;
        float dy = 0.0f;
        if (this.isBubbleScaledByX) {
            dy = ((pxY - pxX) * scaleY) * ColumnChartData.DEFAULT_FILL_RATIO;
        } else {
            dx = ((pxX - pxY) * scaleX) * ColumnChartData.DEFAULT_FILL_RATIO;
        }
        Viewport maxViewport = this.computator.getMaximumViewport();
        maxViewport.inset(dx, dy);
        Viewport currentViewport = this.computator.getCurrentViewport();
        currentViewport.inset(dx, dy);
        this.computator.setMaxViewport(maxViewport);
        this.computator.setCurrentViewport(currentViewport);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:BubbleChartRenderer.java

示例6: calculateMaxViewportForStacked

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
private void calculateMaxViewportForStacked(ColumnChartData data) {
    for (Column column : data.getColumns()) {
        float sumPositive = this.baseValue;
        float sumNegative = this.baseValue;
        for (SubcolumnValue columnValue : column.getValues()) {
            if (columnValue.getValue() >= this.baseValue) {
                sumPositive += columnValue.getValue();
            } else {
                sumNegative += columnValue.getValue();
            }
        }
        if (sumPositive > this.tempMaximumViewport.top) {
            this.tempMaximumViewport.top = sumPositive;
        }
        if (sumNegative < this.tempMaximumViewport.bottom) {
            this.tempMaximumViewport.bottom = sumNegative;
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:ColumnChartRenderer.java

示例7: setupChart

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的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

示例8: setColumnChartData

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
@Override
public void setColumnChartData(ColumnChartData data) {
    if (BuildConfig.DEBUG) {
        Log.d(TAG, "Setting data for ColumnChartView");
    }

    if (null == data) {
        this.data = ColumnChartData.generateDummyData();
    } else {
        this.data = data;
    }

    super.onChartDataChange();

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:ColumnChartView.java

示例9: PreviewColumnChartView

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
public PreviewColumnChartView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    chartComputator = new PreviewChartComputator();
    previewChartRenderer = new PreviewColumnChartRenderer(context, this, this);
    touchHandler = new PreviewChartTouchHandler(context, this);
    setChartRenderer(previewChartRenderer);
    setColumnChartData(ColumnChartData.generateDummyData());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:PreviewColumnChartView.java

示例10: onChartDataChanged

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
@Override
public void onChartDataChanged() {
    super.onChartDataChanged();
    ColumnChartData data = dataProvider.getColumnChartData();
    fillRatio = data.getFillRatio();
    baseValue = data.getBaseValue();

    onChartViewportChanged();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:ColumnChartRenderer.java

示例11: draw

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
public void draw(Canvas canvas) {
    final ColumnChartData data = dataProvider.getColumnChartData();
    if (data.isStacked()) {
        drawColumnForStacked(canvas);
        if (isTouched()) {
            highlightColumnForStacked(canvas);
        }
    } else {
        drawColumnsForSubcolumns(canvas);
        if (isTouched()) {
            highlightColumnsForSubcolumns(canvas);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:ColumnChartRenderer.java

示例12: checkTouch

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
public boolean checkTouch(float touchX, float touchY) {
    selectedValue.clear();
    final ColumnChartData data = dataProvider.getColumnChartData();
    if (data.isStacked()) {
        checkTouchForStacked(touchX, touchY);
    } else {
        checkTouchForSubcolumns(touchX, touchY);
    }
    return isTouched();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:ColumnChartRenderer.java

示例13: calculateMaxViewport

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
private void calculateMaxViewport() {
    final ColumnChartData data = dataProvider.getColumnChartData();
    // Column chart always has X values from 0 to numColumns-1, to add some margin on the left and right I added
    // extra 0.5 to the each side, that margins will be negative scaled according to number of columns, so for more
    // columns there will be less margin.
    tempMaximumViewport.set(-0.5f, baseValue, data.getColumns().size() - 0.5f, baseValue);
    if (data.isStacked()) {
        calculateMaxViewportForStacked(data);
    } else {
        calculateMaxViewportForSubcolumns(data);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:ColumnChartRenderer.java

示例14: calculateMaxViewportForSubcolumns

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
private void calculateMaxViewportForSubcolumns(ColumnChartData data) {
    for (Column column : data.getColumns()) {
        for (SubcolumnValue columnValue : column.getValues()) {
            if (columnValue.getValue() >= baseValue && columnValue.getValue() > tempMaximumViewport.top) {
                tempMaximumViewport.top = columnValue.getValue();
            }
            if (columnValue.getValue() < baseValue && columnValue.getValue() < tempMaximumViewport.bottom) {
                tempMaximumViewport.bottom = columnValue.getValue();
            }
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:ColumnChartRenderer.java

示例15: drawColumnsForSubcolumns

import lecho.lib.hellocharts.model.ColumnChartData; //导入依赖的package包/类
private void drawColumnsForSubcolumns(Canvas canvas) {
    final ColumnChartData data = dataProvider.getColumnChartData();
    final float columnWidth = calculateColumnWidth();
    int columnIndex = 0;
    for (Column column : data.getColumns()) {
        processColumnForSubcolumns(canvas, column, columnWidth, columnIndex, MODE_DRAW);
        ++columnIndex;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:ColumnChartRenderer.java


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