1ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey/* 2ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * Copyright (C) 2011 The Android Open Source Project 3ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * 4ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * Licensed under the Apache License, Version 2.0 (the "License"); 5ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * you may not use this file except in compliance with the License. 6ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * You may obtain a copy of the License at 7ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * 8ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * http://www.apache.org/licenses/LICENSE-2.0 9ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * 10ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * Unless required by applicable law or agreed to in writing, software 11ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * distributed under the License is distributed on an "AS IS" BASIS, 12ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * See the License for the specific language governing permissions and 14ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * limitations under the License. 15ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey */ 16ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey 17ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkeypackage com.android.settings.widget; 18ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey 19ec3be8a4a5efa0e98aeefbf22bb876d09f08a023Jeff Sharkeyimport android.content.res.Resources; 20ec3be8a4a5efa0e98aeefbf22bb876d09f08a023Jeff Sharkeyimport android.text.SpannableStringBuilder; 21ec3be8a4a5efa0e98aeefbf22bb876d09f08a023Jeff Sharkey 22ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey/** 23ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * Axis along a {@link ChartView} that knows how to convert between raw point 24ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey * and screen coordinate systems. 25ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey */ 26ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkeypublic interface ChartAxis { 27ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey 28e2afc0f283f58ce60c107643978bfff25ec5d5c1Jeff Sharkey /** Set range of raw values this axis should cover. */ 29b98c55bd097e006703352f84f0271dec5181160aJeff Sharkey public boolean setBounds(long min, long max); 30e2afc0f283f58ce60c107643978bfff25ec5d5c1Jeff Sharkey /** Set range of screen points this axis should cover. */ 31b98c55bd097e006703352f84f0271dec5181160aJeff Sharkey public boolean setSize(float size); 32ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey 33e2afc0f283f58ce60c107643978bfff25ec5d5c1Jeff Sharkey /** Convert raw value into screen point. */ 34ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey public float convertToPoint(long value); 35e2afc0f283f58ce60c107643978bfff25ec5d5c1Jeff Sharkey /** Convert screen point into raw value. */ 36ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey public long convertToValue(float point); 37ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey 3828130d96385d7d7b17992b45fb5d124836d85880Jeff Sharkey /** 3928130d96385d7d7b17992b45fb5d124836d85880Jeff Sharkey * Build label that describes given raw value. If the label is rounded for 4028130d96385d7d7b17992b45fb5d124836d85880Jeff Sharkey * display, return the rounded value. 4128130d96385d7d7b17992b45fb5d124836d85880Jeff Sharkey */ 4228130d96385d7d7b17992b45fb5d124836d85880Jeff Sharkey public long buildLabel(Resources res, SpannableStringBuilder builder, long value); 43ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey 44e2afc0f283f58ce60c107643978bfff25ec5d5c1Jeff Sharkey /** Return list of tick points for drawing a grid. */ 45ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey public float[] getTickPoints(); 46ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey 47e2afc0f283f58ce60c107643978bfff25ec5d5c1Jeff Sharkey /** 48e2afc0f283f58ce60c107643978bfff25ec5d5c1Jeff Sharkey * Test if given raw value should cause the axis to grow or shrink; 49e2afc0f283f58ce60c107643978bfff25ec5d5c1Jeff Sharkey * returning positive value to grow and negative to shrink. 50e2afc0f283f58ce60c107643978bfff25ec5d5c1Jeff Sharkey */ 51e2afc0f283f58ce60c107643978bfff25ec5d5c1Jeff Sharkey public int shouldAdjustAxis(long value); 52e2afc0f283f58ce60c107643978bfff25ec5d5c1Jeff Sharkey 53ab2d8d3a38857b8c155e6c6393c5821f5a341aaeJeff Sharkey} 54