本文整理汇总了Java中com.github.mikephil.charting.components.XAxis.XAxisPosition类的典型用法代码示例。如果您正苦于以下问题:Java XAxisPosition类的具体用法?Java XAxisPosition怎么用?Java XAxisPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XAxisPosition类属于com.github.mikephil.charting.components.XAxis包,在下文中一共展示了XAxisPosition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: renderAxisLine
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public void renderAxisLine(Canvas c) {
if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
return;
mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());
if (mXAxis.getPosition() == XAxisPosition.TOP
|| mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
|| mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
c.drawLine(mViewPortHandler.contentRight(),
mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
mViewPortHandler.contentBottom(), mAxisLinePaint);
}
if (mXAxis.getPosition() == XAxisPosition.BOTTOM
|| mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
|| mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
c.drawLine(mViewPortHandler.contentLeft(),
mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
mViewPortHandler.contentBottom(), mAxisLinePaint);
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:XAxisRendererHorizontalBarChart.java
示例2: renderAxisLine
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public void renderAxisLine(Canvas c) {
if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
return;
mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());
mAxisLinePaint.setPathEffect(mXAxis.getAxisLineDashPathEffect());
if (mXAxis.getPosition() == XAxisPosition.TOP
|| mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
|| mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
c.drawLine(mViewPortHandler.contentLeft(),
mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
mViewPortHandler.contentTop(), mAxisLinePaint);
}
if (mXAxis.getPosition() == XAxisPosition.BOTTOM
|| mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
|| mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
c.drawLine(mViewPortHandler.contentLeft(),
mViewPortHandler.contentBottom(), mViewPortHandler.contentRight(),
mViewPortHandler.contentBottom(), mAxisLinePaint);
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:XAxisRenderer.java
示例3: renderAxisLine
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public void renderAxisLine(Canvas c) {
if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())
return;
mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());
if (mXAxis.getPosition() == XAxisPosition.TOP
|| mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
|| mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
c.drawLine(mViewPortHandler.contentLeft(),
mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
mViewPortHandler.contentTop(), mAxisLinePaint);
}
if (mXAxis.getPosition() == XAxisPosition.BOTTOM
|| mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
|| mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
c.drawLine(mViewPortHandler.contentLeft(),
mViewPortHandler.contentBottom(), mViewPortHandler.contentRight(),
mViewPortHandler.contentBottom(), mAxisLinePaint);
}
}
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:26,代码来源:XAxisRenderer.java
示例4: setXAxis
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
/**
* xAxis config details: https://github.com/PhilJay/MPAndroidChart/wiki/XAxis
*/
@ReactProp(name = "xAxis")
public void setXAxis(Chart chart, ReadableMap propMap) {
XAxis axis = chart.getXAxis();
setCommonAxisConfig(chart, axis, propMap);
if (BridgeUtils.validate(propMap, ReadableType.Number, "labelsToSkip")) {
axis.setLabelsToSkip(propMap.getInt("labelsToSkip"));
}
if (BridgeUtils.validate(propMap, ReadableType.Boolean, "avoidFirstLastClipping")) {
axis.setAvoidFirstLastClipping(propMap.getBoolean("avoidFirstLastClipping"));
}
if (BridgeUtils.validate(propMap, ReadableType.Number, "spaceBetweenLabels")) {
axis.setSpaceBetweenLabels(propMap.getInt("spaceBetweenLabels"));
}
if (BridgeUtils.validate(propMap, ReadableType.String, "position")) {
axis.setPosition(XAxisPosition.valueOf(propMap.getString("position")));
}
}
开发者ID:mskec,项目名称:react-native-mp-android-chart,代码行数:23,代码来源:ChartBaseManager.java
示例5: onCreateView
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_simple_scatter, container, false);
mChart = (ScatterChart) v.findViewById(R.id.scatterChart1);
mChart.getDescription().setEnabled(false);
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
mv.setChartView(mChart); // For bounds control
mChart.setMarker(mv);
mChart.setDrawGridBackground(false);
mChart.setData(generateScatterData(6, 10000, 200));
XAxis xAxis = mChart.getXAxis();
xAxis.setEnabled(true);
xAxis.setPosition(XAxisPosition.BOTTOM);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(tf);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setTypeface(tf);
rightAxis.setDrawGridLines(false);
Legend l = mChart.getLegend();
l.setWordWrapEnabled(true);
l.setTypeface(tf);
l.setFormSize(14f);
l.setTextSize(9f);
// increase the space between legend & bottom and legend & content
l.setYOffset(13f);
mChart.setExtraBottomOffset(16f);
return v;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:ScatterChartFrag.java
示例6: onCreate
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_scrollview);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.getDescription().setEnabled(false);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawBarShadow(false);
mChart.setDrawGridBackground(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(false);
mChart.getAxisLeft().setDrawGridLines(false);
mChart.getLegend().setEnabled(false);
setData(10);
mChart.setFitBars(true);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:ScrollViewActivity.java
示例7: onCreateView
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_simple_scatter, container, false);
mChart = (ScatterChart) v.findViewById(R.id.scatterChart1);
mChart.setDescription("");
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
mChart.setMarkerView(mv);
mChart.setDrawGridBackground(false);
mChart.setData(generateScatterData(6, 10000, 200));
XAxis xAxis = mChart.getXAxis();
xAxis.setEnabled(true);
xAxis.setPosition(XAxisPosition.BOTTOM);
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(tf);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setTypeface(tf);
rightAxis.setDrawGridLines(false);
Legend l = mChart.getLegend();
l.setWordWrapEnabled(true);
l.setTypeface(tf);
l.setFormSize(14f);
l.setTextSize(9f);
// increase the space between legend & bottom and legend & content
l.setYOffset(13f);
mChart.setExtraBottomOffset(16f);
return v;
}
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:40,代码来源:ScatterChartFrag.java
示例8: onCreate
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_combined);
mChart = (CombinedChart) findViewById(R.id.chart1);
mChart.setDescription("");
mChart.setBackgroundColor(Color.WHITE);
mChart.setDrawGridBackground(false);
mChart.setDrawBarShadow(false);
// draw bars behind lines
mChart.setDrawOrder(new DrawOrder[] {
DrawOrder.BAR, DrawOrder.BUBBLE, DrawOrder.CANDLE, DrawOrder.LINE, DrawOrder.SCATTER
});
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setDrawGridLines(false);
leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTH_SIDED);
CombinedData data = new CombinedData(mMonths);
data.setData(generateLineData());
data.setData(generateBarData());
// data.setData(generateBubbleData());
// data.setData(generateScatterData());
// data.setData(generateCandleData());
mChart.setData(data);
mChart.invalidate();
}
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:41,代码来源:CombinedChartActivity.java
示例9: onCreate
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_scrollview);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setDescription("");
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawBarShadow(false);
mChart.setDrawGridBackground(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setLabelsToSkip(0);
xAxis.setDrawGridLines(false);
mChart.getAxisLeft().setDrawGridLines(false);
mChart.getLegend().setEnabled(false);
setData(10);
}
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:29,代码来源:ScrollViewActivity.java
示例10: initVueMeter
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
public void initVueMeter(){
mChart.setDrawBarShadow(false);
mChart.setDescription("");
mChart.setPinchZoom(false);
mChart.setDrawGridBackground(false);
mChart.setMaxVisibleValueCount(0);
mChart.setScaleXEnabled(false); // Disable scaling on the X-axis
// XAxis parameters: hide all
XAxis xlv = mChart.getXAxis();
xlv.setPosition(XAxisPosition.BOTTOM);
xlv.setDrawAxisLine(false);
xlv.setDrawGridLines(false);
xlv.setDrawLabels(false);
// YAxis parameters (left): main axis for dB values representation
YAxis ylv = mChart.getAxisLeft();
ylv.setDrawAxisLine(false);
ylv.setDrawGridLines(true);
ylv.setAxisMaxValue(110.f);
ylv.setStartAtZero(true);
ylv.setTextColor(Color.WHITE);
ylv.setGridColor(Color.WHITE);
ylv.setValueFormatter(new dBValueFormatter());
// YAxis parameters (right): no axis, hide all
YAxis yrv = mChart.getAxisRight();
yrv.setEnabled(false);
//return true;
}
开发者ID:Ifsttar,项目名称:NoiseCapture,代码行数:28,代码来源:MeasurementActivity.java
示例11: initSpectrumChart
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
public void initSpectrumChart(){
sChart.setPinchZoom(false);
sChart.setDoubleTapToZoomEnabled(false);
sChart.setDrawBarShadow(false);
sChart.setDescription("");
sChart.setPinchZoom(false);
sChart.setDrawGridBackground(false);
sChart.setHighlightPerTapEnabled(true);
sChart.setHighlightPerDragEnabled(false);
sChart.setDrawHighlightArrow(true);
sChart.setDrawValueAboveBar(true);
// XAxis parameters: hide all
XAxis xls = sChart.getXAxis();
xls.setPosition(XAxisPosition.BOTTOM);
xls.setDrawAxisLine(true);
xls.setDrawGridLines(false);
xls.setLabelRotationAngle(-90);
xls.setDrawLabels(true);
xls.setTextColor(Color.WHITE);
xls.setLabelsToSkip(0);
// YAxis parameters (left): main axis for dB values representation
YAxis yls = sChart.getAxisLeft();
yls.setDrawAxisLine(true);
yls.setDrawGridLines(true);
yls.setAxisMaxValue(110.f);
yls.setStartAtZero(true);
yls.setTextColor(Color.WHITE);
yls.setGridColor(Color.WHITE);
// YAxis parameters (right): no axis, hide all
YAxis yrs = sChart.getAxisRight();
yrs.setEnabled(false);
//return true;
}
开发者ID:Ifsttar,项目名称:NoiseCapture,代码行数:34,代码来源:Results.java
示例12: calculateOffsets
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public void calculateOffsets() {
if (!mCustomViewPortEnabled) {
float offsetLeft = 0f, offsetRight = 0f, offsetTop = 0f, offsetBottom = 0f;
calculateLegendOffsets(mOffsetsBuffer);
offsetLeft += mOffsetsBuffer.left;
offsetTop += mOffsetsBuffer.top;
offsetRight += mOffsetsBuffer.right;
offsetBottom += mOffsetsBuffer.bottom;
// offsets for y-labels
if (mAxisLeft.needsOffset()) {
offsetLeft += mAxisLeft.getRequiredWidthSpace(mAxisRendererLeft
.getPaintAxisLabels());
}
if (mAxisRight.needsOffset()) {
offsetRight += mAxisRight.getRequiredWidthSpace(mAxisRendererRight
.getPaintAxisLabels());
}
if (mXAxis.isEnabled() && mXAxis.isDrawLabelsEnabled()) {
float xlabelheight = mXAxis.mLabelRotatedHeight + mXAxis.getYOffset();
// offsets for x-labels
if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
offsetBottom += xlabelheight;
} else if (mXAxis.getPosition() == XAxisPosition.TOP) {
offsetTop += xlabelheight;
} else if (mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
offsetBottom += xlabelheight;
offsetTop += xlabelheight;
}
}
offsetTop += getExtraTopOffset();
offsetRight += getExtraRightOffset();
offsetBottom += getExtraBottomOffset();
offsetLeft += getExtraLeftOffset();
float minOffset = Utils.convertDpToPixel(mMinOffset);
mViewPortHandler.restrainViewPort(
Math.max(minOffset, offsetLeft),
Math.max(minOffset, offsetTop),
Math.max(minOffset, offsetRight),
Math.max(minOffset, offsetBottom));
if (mLogEnabled) {
Log.i(LOG_TAG, "offsetLeft: " + offsetLeft + ", offsetTop: " + offsetTop
+ ", offsetRight: " + offsetRight + ", offsetBottom: " + offsetBottom);
Log.i(LOG_TAG, "Content: " + mViewPortHandler.getContentRect().toString());
}
}
prepareOffsetMatrix();
prepareValuePxMatrix();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:69,代码来源:BarLineChartBase.java
示例13: calculateOffsets
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public void calculateOffsets() {
float offsetLeft = 0f, offsetRight = 0f, offsetTop = 0f, offsetBottom = 0f;
calculateLegendOffsets(mOffsetsBuffer);
offsetLeft += mOffsetsBuffer.left;
offsetTop += mOffsetsBuffer.top;
offsetRight += mOffsetsBuffer.right;
offsetBottom += mOffsetsBuffer.bottom;
// offsets for y-labels
if (mAxisLeft.needsOffset()) {
offsetTop += mAxisLeft.getRequiredHeightSpace(mAxisRendererLeft.getPaintAxisLabels());
}
if (mAxisRight.needsOffset()) {
offsetBottom += mAxisRight.getRequiredHeightSpace(mAxisRendererRight.getPaintAxisLabels());
}
float xlabelwidth = mXAxis.mLabelRotatedWidth;
if (mXAxis.isEnabled()) {
// offsets for x-labels
if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
offsetLeft += xlabelwidth;
} else if (mXAxis.getPosition() == XAxisPosition.TOP) {
offsetRight += xlabelwidth;
} else if (mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
offsetLeft += xlabelwidth;
offsetRight += xlabelwidth;
}
}
offsetTop += getExtraTopOffset();
offsetRight += getExtraRightOffset();
offsetBottom += getExtraBottomOffset();
offsetLeft += getExtraLeftOffset();
float minOffset = Utils.convertDpToPixel(mMinOffset);
mViewPortHandler.restrainViewPort(
Math.max(minOffset, offsetLeft),
Math.max(minOffset, offsetTop),
Math.max(minOffset, offsetRight),
Math.max(minOffset, offsetBottom));
if (mLogEnabled) {
Log.i(LOG_TAG, "offsetLeft: " + offsetLeft + ", offsetTop: " + offsetTop + ", offsetRight: " +
offsetRight + ", offsetBottom: "
+ offsetBottom);
Log.i(LOG_TAG, "Content: " + mViewPortHandler.getContentRect().toString());
}
prepareOffsetMatrix();
prepareValuePxMatrix();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:65,代码来源:HorizontalBarChart.java
示例14: renderAxisLabels
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public void renderAxisLabels(Canvas c) {
if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())
return;
float xoffset = mXAxis.getXOffset();
mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
mAxisLabelPaint.setColor(mXAxis.getTextColor());
MPPointF pointF = MPPointF.getInstance(0,0);
if (mXAxis.getPosition() == XAxisPosition.TOP) {
pointF.x = 0.0f;
pointF.y = 0.5f;
drawLabels(c, mViewPortHandler.contentRight() + xoffset, pointF);
} else if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {
pointF.x = 1.0f;
pointF.y = 0.5f;
drawLabels(c, mViewPortHandler.contentRight() - xoffset, pointF);
} else if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
pointF.x = 1.0f;
pointF.y = 0.5f;
drawLabels(c, mViewPortHandler.contentLeft() - xoffset, pointF);
} else if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {
pointF.x = 1.0f;
pointF.y = 0.5f;
drawLabels(c, mViewPortHandler.contentLeft() + xoffset, pointF);
} else { // BOTH SIDED
pointF.x = 0.0f;
pointF.y = 0.5f;
drawLabels(c, mViewPortHandler.contentRight() + xoffset, pointF);
pointF.x = 1.0f;
pointF.y = 0.5f;
drawLabels(c, mViewPortHandler.contentLeft() - xoffset, pointF);
}
MPPointF.recycleInstance(pointF);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:46,代码来源:XAxisRendererHorizontalBarChart.java
示例15: renderAxisLabels
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public void renderAxisLabels(Canvas c) {
if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())
return;
float yoffset = mXAxis.getYOffset();
mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
mAxisLabelPaint.setColor(mXAxis.getTextColor());
MPPointF pointF = MPPointF.getInstance(0,0);
if (mXAxis.getPosition() == XAxisPosition.TOP) {
pointF.x = 0.5f;
pointF.y = 1.0f;
drawLabels(c, mViewPortHandler.contentTop() - yoffset, pointF);
} else if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {
pointF.x = 0.5f;
pointF.y = 1.0f;
drawLabels(c, mViewPortHandler.contentTop() + yoffset + mXAxis.mLabelRotatedHeight, pointF);
} else if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
pointF.x = 0.5f;
pointF.y = 0.0f;
drawLabels(c, mViewPortHandler.contentBottom() + yoffset, pointF);
} else if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {
pointF.x = 0.5f;
pointF.y = 0.0f;
drawLabels(c, mViewPortHandler.contentBottom() - yoffset - mXAxis.mLabelRotatedHeight, pointF);
} else { // BOTH SIDED
pointF.x = 0.5f;
pointF.y = 1.0f;
drawLabels(c, mViewPortHandler.contentTop() - yoffset, pointF);
pointF.x = 0.5f;
pointF.y = 0.0f;
drawLabels(c, mViewPortHandler.contentBottom() + yoffset, pointF);
}
MPPointF.recycleInstance(pointF);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:44,代码来源:XAxisRenderer.java
示例16: onCreate
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarY.setOnSeekBarChangeListener(this);
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setOnChartValueSelectedListener(this);
mChart.getDescription().setEnabled(false);
// if more than 60 entries are displayed in the chart, no values will be
// drawn
mChart.setMaxVisibleValueCount(40);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawGridBackground(false);
mChart.setDrawBarShadow(false);
mChart.setDrawValueAboveBar(false);
mChart.setHighlightFullBarEnabled(false);
// change the position of the y-labels
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setValueFormatter(new MyAxisValueFormatter());
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
mChart.getAxisRight().setEnabled(false);
XAxis xLabels = mChart.getXAxis();
xLabels.setPosition(XAxisPosition.TOP);
// mChart.setDrawXLabels(false);
// mChart.setDrawYLabels(false);
// setting data
mSeekBarX.setProgress(12);
mSeekBarY.setProgress(100);
Legend l = mChart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
l.setFormSize(8f);
l.setFormToTextSpace(4f);
l.setXEntrySpace(6f);
// mChart.setDrawLegend(false);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:61,代码来源:StackedBarActivity.java
示例17: getView
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
BarData data = getItem(position);
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = LayoutInflater.from(getContext()).inflate(
R.layout.list_item_barchart, null);
holder.chart = (BarChart) convertView.findViewById(R.id.chart);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// apply styling
data.setValueTypeface(mTfLight);
data.setValueTextColor(Color.BLACK);
holder.chart.getDescription().setEnabled(false);
holder.chart.setDrawGridBackground(false);
XAxis xAxis = holder.chart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setTypeface(mTfLight);
xAxis.setDrawGridLines(false);
YAxis leftAxis = holder.chart.getAxisLeft();
leftAxis.setTypeface(mTfLight);
leftAxis.setLabelCount(5, false);
leftAxis.setSpaceTop(15f);
YAxis rightAxis = holder.chart.getAxisRight();
rightAxis.setTypeface(mTfLight);
rightAxis.setLabelCount(5, false);
rightAxis.setSpaceTop(15f);
// set data
holder.chart.setData(data);
holder.chart.setFitBars(true);
// do not forget to refresh the chart
// holder.chart.invalidate();
holder.chart.animateY(700);
return convertView;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:53,代码来源:ListViewBarChartActivity.java
示例18: onCreate
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_combined);
mChart = (CombinedChart) findViewById(R.id.chart1);
mChart.getDescription().setEnabled(false);
mChart.setBackgroundColor(Color.WHITE);
mChart.setDrawGridBackground(false);
mChart.setDrawBarShadow(false);
mChart.setHighlightFullBarEnabled(false);
// draw bars behind lines
mChart.setDrawOrder(new DrawOrder[]{
DrawOrder.BAR, DrawOrder.BUBBLE, DrawOrder.CANDLE, DrawOrder.LINE, DrawOrder.SCATTER
});
Legend l = mChart.getLegend();
l.setWordWrapEnabled(true);
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
YAxis rightAxis = mChart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setDrawGridLines(false);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTH_SIDED);
xAxis.setAxisMinimum(0f);
xAxis.setGranularity(1f);
xAxis.setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
return mMonths[(int) value % mMonths.length];
}
});
CombinedData data = new CombinedData();
data.setData(generateLineData());
data.setData(generateBarData());
data.setData(generateBubbleData());
data.setData(generateScatterData());
data.setData(generateCandleData());
data.setValueTypeface(mTfLight);
xAxis.setAxisMaximum(data.getXMax() + 0.25f);
mChart.setData(data);
mChart.invalidate();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:60,代码来源:CombinedChartActivity.java
示例19: onCreate
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_barchart_noseekbar);
mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
mChart = (BarChart) findViewById(R.id.chart1);
mChart.setBackgroundColor(Color.WHITE);
mChart.setExtraTopOffset(-30f);
mChart.setExtraBottomOffset(10f);
mChart.setExtraLeftOffset(70f);
mChart.setExtraRightOffset(70f);
mChart.setDrawBarShadow(false);
mChart.setDrawValueAboveBar(true);
mChart.getDescription().setEnabled(false);
// scaling can now only be done on x- and y-axis separately
mChart.setPinchZoom(false);
mChart.setDrawGridBackground(false);
XAxis xAxis = mChart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setTypeface(mTf);
xAxis.setDrawGridLines(false);
xAxis.setDrawAxisLine(false);
xAxis.setTextColor(Color.LTGRAY);
xAxis.setTextSize(13f);
xAxis.setLabelCount(5);
xAxis.setCenterAxisLabels(true);
xAxis.setGranularity(1f);
YAxis left = mChart.getAxisLeft();
left.setDrawLabels(false);
left.setSpaceTop(25f);
left.setSpaceBottom(25f);
left.setDrawAxisLine(false);
left.setDrawGridLines(false);
left.setDrawZeroLine(true); // draw a zero line
left.setZeroLineColor(Color.GRAY);
left.setZeroLineWidth(0.7f);
mChart.getAxisRight().setEnabled(false);
mChart.getLegend().setEnabled(false);
// THIS IS THE ORIGINAL DATA YOU WANT TO PLOT
final List<Data> data = new ArrayList<>();
data.add(new Data(0f, -224.1f, "12-29"));
data.add(new Data(1f, 238.5f, "12-30"));
data.add(new Data(2f, 1280.1f, "12-31"));
data.add(new Data(3f, -442.3f, "01-01"));
data.add(new Data(4f, -2280.1f, "01-02"));
xAxis.setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
return data.get(Math.min(Math.max((int) value, 0), data.size()-1)).xAxisValue;
}
});
setData(data);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:66,代码来源:BarChartPositiveNegative.java
示例20: getView
import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, Context c) {
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = LayoutInflater.from(c).inflate(
R.layout.list_item_linechart, null);
holder.chart = (LineChart) convertView.findViewById(R.id.chart);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// apply styling
// holder.chart.setValueTypeface(mTf);
holder.chart.getDescription().setEnabled(false);
holder.chart.setDrawGridBackground(false);
XAxis xAxis = holder.chart.getXAxis();
xAxis.setPosition(XAxisPosition.BOTTOM);
xAxis.setTypeface(mTf);
xAxis.setDrawGridLines(false);
xAxis.setDrawAxisLine(true);
YAxis leftAxis = holder.chart.getAxisLeft();
leftAxis.setTypeface(mTf);
leftAxis.setLabelCount(5, false);
leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
YAxis rightAxis = holder.chart.getAxisRight();
rightAxis.setTypeface(mTf);
rightAxis.setLabelCount(5, false);
rightAxis.setDrawGridLines(false);
rightAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)
// set data
holder.chart.setData((LineData) mChartData);
// do not forget to refresh the chart
// holder.chart.invalidate();
holder.chart.animateX(750);
return convertView;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:51,代码来源:LineChartItem.java
注:本文中的com.github.mikephil.charting.components.XAxis.XAxisPosition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论