本文整理汇总了Java中lecho.lib.hellocharts.view.LineChartView.setMaximumViewport方法的典型用法代码示例。如果您正苦于以下问题:Java LineChartView.setMaximumViewport方法的具体用法?Java LineChartView.setMaximumViewport怎么用?Java LineChartView.setMaximumViewport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.view.LineChartView
的用法示例。
在下文中一共展示了LineChartView.setMaximumViewport方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import lecho.lib.hellocharts.view.LineChartView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_good_bad, container, false);
chart = (LineChartView) rootView.findViewById(R.id.chart);
generateDefaultData();
chart.setLineChartData(data);
// Increase viewport height for better look
Viewport v = chart.getMaximumViewport();
float dy = v.height() * 0.2f;
v.inset(0, -dy);
chart.setMaximumViewport(v);
chart.setCurrentViewport(v);
return rootView;
}
示例2: onViewportChanged
import lecho.lib.hellocharts.view.LineChartView; //导入方法依赖的package包/类
@Override
public void onViewportChanged(Viewport newViewport) {
if (!updatingPreviewViewport) {
updatingChartViewport = true;
bgPreviewChart.setZoomType(ZoomType.HORIZONTAL);
bgPreviewChart.setCurrentViewport(newViewport);
updatingChartViewport = false;
if (iobcobFragmentObject.getView() != null) { //Fragment is loaded
LineChartView iobcobPastChart = (LineChartView) findViewById(R.id.iobcobPast);
Viewport iobv = new Viewport(bgChart.getMaximumViewport()); //Update the IOB COB Line Chart Viewport to stay inline with the preview
iobv.left = newViewport.left;
iobv.right = newViewport.right;
iobv.top = iobcobPastChart.getMaximumViewport().top;
iobv.bottom = iobcobPastChart.getMaximumViewport().bottom;
iobcobPastChart.setMaximumViewport(iobv);
iobcobPastChart.setCurrentViewport(iobv);
}
if (basalvsTempBasalObject.getView() != null){
LineChartView bvbChart = (LineChartView) findViewById(R.id.basalvsTempBasal_LineChart);
Viewport bvbv = new Viewport(bgChart.getMaximumViewport());
bvbv.left = newViewport.left;
bvbv.right = newViewport.right;
bvbv.top = bvbChart.getMaximumViewport().top;
bvbv.bottom = bvbChart.getMaximumViewport().bottom;
bvbChart.setMaximumViewport(bvbv);
bvbChart.setCurrentViewport(bvbv);
}
}
}
示例3: updateGraph
import lecho.lib.hellocharts.view.LineChartView; //导入方法依赖的package包/类
private void updateGraph(List<LivePvDatum> livePvData) {
LinearLayout graphLinearLayout = (LinearLayout) fragmentView.findViewById(graph);
graphLinearLayout.removeAllViews();
final Context context = getContext();
if (context != null) {
LineChartView lineChartView = new LineChartView(context);
graphLinearLayout.addView(lineChartView);
List<PointValue> powerPointValues = new ArrayList<>();
for (int i = 0; i < livePvData.size(); i++) {
LivePvDatum livePvDatum = livePvData.get(i);
float x = (float) i;
float y = (float) livePvDatum.getPowerGeneration();
powerPointValues.add(new PointValue(x, y));
}
List<Line> lines = new ArrayList<>();
Line powerLine = new Line(powerPointValues)
.setColor(ChartUtils.COLORS[0])
.setHasPoints(false)
.setCubic(true)
.setFilled(true);
lines.add(powerLine);
LineChartData lineChartData = new LineChartData();
lineChartData.setLines(lines);
RecordPvDatum recordPvDatum = pvDataOperations.loadRecord();
double yAxisMax = Math.max(recordPvDatum.getLivePowerGeneration(), 1.0);
AxisLabelValues axisLabelValues = FormatUtils.getAxisLabelValues(yAxisMax);
Axis yAxis = Axis
.generateAxisFromRange(0, axisLabelValues.getMax(), axisLabelValues.getStep())
.setMaxLabelChars(6)
.setTextColor(Color.GRAY)
.setHasLines(true);
yAxis.setName(getResources().getString(R.string.graph_legend_power));
lineChartData.setAxisYLeft(yAxis);
lineChartView.setLineChartData(lineChartData);
lineChartView.setViewportCalculationEnabled(false);
Viewport viewport = new Viewport(-1, axisLabelValues.getView(), livePvData.size(), 0);
lineChartView.setMaximumViewport(viewport);
lineChartView.setCurrentViewport(viewport);
}
}