本文整理匯總了Java中com.github.mikephil.charting.components.AxisBase類的典型用法代碼示例。如果您正苦於以下問題:Java AxisBase類的具體用法?Java AxisBase怎麽用?Java AxisBase使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AxisBase類屬於com.github.mikephil.charting.components包,在下文中一共展示了AxisBase類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: AxisRenderer
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
public AxisRenderer(ViewPortHandler viewPortHandler, Transformer trans, AxisBase axis) {
super(viewPortHandler);
this.mTrans = trans;
this.mAxis = axis;
if(mViewPortHandler != null) {
mAxisLabelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mGridPaint = new Paint();
mGridPaint.setColor(Color.GRAY);
mGridPaint.setStrokeWidth(1f);
mGridPaint.setStyle(Style.STROKE);
mGridPaint.setAlpha(90);
mAxisLinePaint = new Paint();
mAxisLinePaint.setColor(Color.BLACK);
mAxisLinePaint.setStrokeWidth(1f);
mAxisLinePaint.setStyle(Style.STROKE);
mLimitLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mLimitLinePaint.setStyle(Paint.Style.STROKE);
}
}
示例2: getFormattedValue
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
@Override
public String getFormattedValue(float value, AxisBase axis) {
//Log.i("TRANS", "x: " + viewPortHandler.getTransX() + ", y: " + viewPortHandler.getTransY());
// e.g. adjust the x-axis values depending on scale / zoom level
final float xScale = mViewPortHandler.getScaleX();
if (xScale > 5)
return "4";
else if (xScale > 3)
return "3";
else if (xScale > 1)
return "2";
else
return mFormat.format(value);
}
示例3: chartXAxisStyling
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
@SuppressWarnings("deprecation")
private void chartXAxisStyling(XAxis xAxis) {
xAxis.setPosition(XAxis.XAxisPosition.TOP);
xAxis.setTextColor(getResources().getColor(R.color.traffic_chart_text_color_light));
xAxis.setDrawAxisLine(true);
xAxis.setDrawGridLines(false);
xAxis.setCenterAxisLabels(true);
xAxis.setValueFormatter(new AxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
return Utils.humanReadable((long) value);
}
@Override
public int getDecimalDigits() {
return 0;
}
});
}
示例4: getFormattedValue
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
@Override
public String getFormattedValue(float value, AxisBase axis)
{
if ( value == 0.0 || labels.isEmpty() )
{
return StringUtils.EMPTY;
}
else
{
value = value - 1;
if ( value >= labels.size() )
{
return StringUtils.EMPTY;
}
else
{
return labels.get((int) value);
}
}
}
示例5: notifyDataSetChanged
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
/**
* 更新圖表
*
* @param chart 圖表
* @param values 數據
* @param valueType 數據類型
*/
public static void notifyDataSetChanged(LineChart chart, List<Entry> values,
final int valueType) {
chart.getXAxis().setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
return xValuesProcess(valueType)[(int) value];
}
});
chart.invalidate();
setChartData(chart, values);
}
示例6: getFormattedValue
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
public String getFormattedValue(float value, AxisBase axis) {
int index = Math.round(value);
if (index < 0 || index >= mValueCount || index != (int)value)
return "";
return mValues[index];
}
示例7: getFormattedValue
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
@Override
public String getFormattedValue(float value, AxisBase axis) {
if (value > 3) {
return super.getFormattedValue(value, axis);
} else {
return "";
}
}
示例8: getFormattedValue
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
@Override
public String getFormattedValue(float value, AxisBase axis) {
int v = (int) value;
if (v >= 0 && v < JOB_SOFT.length) {
return JOB_SOFT[((int) value)];
}
return "";
}
示例9: getFormattedValue
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
@Override
public String getFormattedValue(float value, AxisBase axis) {
if ((int) value >= 0 && value < month.length) {
return month[(int) value];
}
return "";
}
示例10: getFormattedValue
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
@Override
public String getFormattedValue(float value, AxisBase axis) {
if ((int) value >= 0 && value < jobs.length) {
String title = jobs[(int) value];
if (title.length() > Config.JOBS_LENGTH) {
title = title.substring(0, Config.JOBS_LENGTH);
}
return title;
}
return "";
}
示例11: getFormattedValue
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
@Override
public String getFormattedValue(float value, AxisBase axis) {
if (dispalyInUsd) {
return value >= 0 ? ((int) value) + "" : "";
} else {
return value >= 0 ? Math.floor(value * 1000) / 1000 + "" : "";
}
}
示例12: getFormattedValue
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
@Override
public String getFormattedValue(float value, AxisBase axis) {
try{
if (dateFormater==null ||dateFormater.equals(""))
return DateFormater.getInstance().getDate( measureList.get((int)value).getTimeStamp());
return DateFormater.getInstance().getDateByFormat( measureList.get((int)value).getTimeStamp(),dateFormater);
}
catch (Exception ex)
{
return "";
}
}
示例13: getFormattedValue
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
@Override
public String getFormattedValue(float value, AxisBase axis) {
if (!mMap.get((int) value)) {
mMap.put((int) value, true);
return mValues[(int) value];
} else {
return "";
}
}
示例14: getFormattedValue
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
@Override
public String getFormattedValue(float value, AxisBase axis) {
try {
return Utils.getFormattedDateTime((mChartDates.get((int) value)) * 1000, true);
} catch (Exception ignored) {
return "";
}
}
示例15: getFormattedValue
import com.github.mikephil.charting.components.AxisBase; //導入依賴的package包/類
@Override
public String getFormattedValue(float value, AxisBase axis) {
try{
SimpleDateFormat sdf = new SimpleDateFormat("h:mm a \n dd/MM/yyyy");
Date date = new Date((long) value);
return sdf.format(date);
}
catch(Exception ex){
return "No time";
}
}