本文整理汇总了Java中org.achartengine.chart.XYChart类的典型用法代码示例。如果您正苦于以下问题:Java XYChart类的具体用法?Java XYChart怎么用?Java XYChart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XYChart类属于org.achartengine.chart包,在下文中一共展示了XYChart类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TouchHandler
import org.achartengine.chart.XYChart; //导入依赖的package包/类
/**
* Creates a new graphical view.
*
* @param view the graphical view
* @param chart the chart to be drawn
*/
public TouchHandler(GraphicalView view, AbstractChart chart) {
graphicalView = view;
zoomR = graphicalView.getZoomRectangle();
if (chart instanceof XYChart) {
mRenderer = ((XYChart) chart).getRenderer();
} else {
mRenderer = ((RoundChart) chart).getRenderer();
}
if (mRenderer.isPanEnabled()) {
mPan = new Pan(chart);
}
if (mRenderer.isZoomEnabled()) {
mPinchZoom = new Zoom(chart, true, 1);
}
}
示例2: checkRange
import org.achartengine.chart.XYChart; //导入依赖的package包/类
/**
* Sets the range to the calculated one, if not already set.
*
* @param range the range
* @param scale the scale
*/
public void checkRange(double[] range, int scale) {
if (mChart instanceof XYChart) {
double[] calcRange = ((XYChart) mChart).getCalcRange(scale);
if (calcRange != null) {
if (!mRenderer.isMinXSet(scale)) {
range[0] = calcRange[0];
mRenderer.setXAxisMin(range[0], scale);
}
if (!mRenderer.isMaxXSet(scale)) {
range[1] = calcRange[1];
mRenderer.setXAxisMax(range[1], scale);
}
if (!mRenderer.isMinYSet(scale)) {
range[2] = calcRange[2];
mRenderer.setYAxisMin(range[2], scale);
}
if (!mRenderer.isMaxYSet(scale)) {
range[3] = calcRange[3];
mRenderer.setYAxisMax(range[3], scale);
}
}
}
}
示例3: TouchHandler
import org.achartengine.chart.XYChart; //导入依赖的package包/类
public TouchHandler(GraphicalView graphicalview, AbstractChart abstractchart)
{
f = new RectF();
i = graphicalview;
f = i.getZoomRectangle();
if (abstractchart instanceof XYChart)
{
a = ((XYChart)abstractchart).getRenderer();
} else
{
a = ((RoundChart)abstractchart).getRenderer();
}
if (a.isPanEnabled())
{
g = new Pan(abstractchart);
}
if (a.isZoomEnabled())
{
h = new Zoom(abstractchart, true, 1.0F);
}
}
示例4: TouchHandlerOld
import org.achartengine.chart.XYChart; //导入依赖的package包/类
public TouchHandlerOld(GraphicalView graphicalview, AbstractChart abstractchart)
{
d = new RectF();
f = graphicalview;
d = f.getZoomRectangle();
if (abstractchart instanceof XYChart)
{
a = ((XYChart)abstractchart).getRenderer();
} else
{
a = ((RoundChart)abstractchart).getRenderer();
}
if (a.isPanEnabled())
{
e = new Pan(abstractchart);
}
}
示例5: toRealPoint
import org.achartengine.chart.XYChart; //导入依赖的package包/类
/**
* Transforms the currently selected screen point to a real point.
*
* @param scale the scale
* @return the currently selected real point
*/
public double[] toRealPoint(int scale) {
if (mChart instanceof XYChart) {
XYChart chart = (XYChart) mChart;
return chart.toRealPoint(oldX, oldY, scale);
}
return null;
}
示例6: AbstractTool
import org.achartengine.chart.XYChart; //导入依赖的package包/类
/**
* Abstract tool constructor.
*
* @param chart the chart
*/
public AbstractTool(AbstractChart chart) {
mChart = chart;
if (chart instanceof XYChart) {
mRenderer = ((XYChart) chart).getRenderer();
}
}
示例7: TouchHandlerOld
import org.achartengine.chart.XYChart; //导入依赖的package包/类
/**
* Creates an implementation of the old version of the touch handler.
*
* @param view the graphical view
* @param chart the chart to be drawn
*/
public TouchHandlerOld(GraphicalView view, AbstractChart chart) {
graphicalView = view;
zoomR = graphicalView.getZoomRectangle();
if (chart instanceof XYChart) {
mRenderer = ((XYChart) chart).getRenderer();
} else {
mRenderer = ((RoundChart) chart).getRenderer();
}
if (mRenderer.isPanEnabled()) {
mPan = new Pan(chart);
}
}
示例8: toRealPoint
import org.achartengine.chart.XYChart; //导入依赖的package包/类
public double[] toRealPoint(int i1)
{
if (a instanceof XYChart)
{
return ((XYChart)a).toRealPoint(p, q, i1);
} else
{
return null;
}
}
示例9: AbstractTool
import org.achartengine.chart.XYChart; //导入依赖的package包/类
public AbstractTool(AbstractChart abstractchart)
{
mChart = abstractchart;
if (abstractchart instanceof XYChart)
{
mRenderer = ((XYChart)abstractchart).getRenderer();
}
}
示例10: checkRange
import org.achartengine.chart.XYChart; //导入依赖的package包/类
public void checkRange(double ad[], int i)
{
if (mChart instanceof XYChart)
{
double ad1[] = ((XYChart)mChart).getCalcRange(i);
if (ad1 != null)
{
if (!mRenderer.isMinXSet(i))
{
ad[0] = ad1[0];
mRenderer.setXAxisMin(ad[0], i);
}
if (!mRenderer.isMaxXSet(i))
{
ad[1] = ad1[1];
mRenderer.setXAxisMax(ad[1], i);
}
if (!mRenderer.isMinYSet(i))
{
ad[2] = ad1[2];
mRenderer.setYAxisMin(ad[2], i);
}
if (!mRenderer.isMaxYSet(i))
{
ad[3] = ad1[3];
mRenderer.setYAxisMax(ad[3], i);
}
}
}
}
示例11: GraphicalView
import org.achartengine.chart.XYChart; //导入依赖的package包/类
/**
* Creates a new graphical view.
*
* @param context the context
* @param chart the chart to be drawn
*/
public GraphicalView(Context context, AbstractChart chart) {
super(context);
mChart = chart;
mHandler = new Handler();
if (mChart instanceof XYChart) {
mRenderer = ((XYChart) mChart).getRenderer();
} else {
mRenderer = ((RoundChart) mChart).getRenderer();
}
if (mRenderer.isZoomButtonsVisible()) {
zoomInImage = BitmapFactory.decodeStream(GraphicalView.class
.getResourceAsStream("image/zoom_in.png"));
zoomOutImage = BitmapFactory.decodeStream(GraphicalView.class
.getResourceAsStream("image/zoom_out.png"));
fitZoomImage = BitmapFactory.decodeStream(GraphicalView.class
.getResourceAsStream("image/zoom-1.png"));
}
if (mRenderer instanceof XYMultipleSeriesRenderer
&& ((XYMultipleSeriesRenderer) mRenderer).getMarginsColor() == XYMultipleSeriesRenderer.NO_COLOR) {
((XYMultipleSeriesRenderer) mRenderer).setMarginsColor(mPaint.getColor());
}
if (mRenderer.isZoomEnabled() && mRenderer.isZoomButtonsVisible()
|| mRenderer.isExternalZoomEnabled()) {
mZoomIn = new Zoom(mChart, true, mRenderer.getZoomRate());
mZoomOut = new Zoom(mChart, false, mRenderer.getZoomRate());
mFitZoom = new FitZoom(mChart);
}
int version = 7;
try {
version = Integer.valueOf(Build.VERSION.SDK);
} catch (Exception e) {
// do nothing
}
if (version < 7) {
mTouchHandler = new TouchHandlerOld(this, mChart);
} else {
mTouchHandler = new TouchHandler(this, mChart);
}
}
示例12: apply
import org.achartengine.chart.XYChart; //导入依赖的package包/类
/**
* Apply the tool.
*/
public void apply() {
if (mChart instanceof XYChart) {
if (((XYChart) mChart).getDataset() == null) {
return;
}
int scales = mRenderer.getScalesCount();
if (mRenderer.isInitialRangeSet()) {
for (int i = 0; i < scales; i++) {
if (mRenderer.isInitialRangeSet(i)) {
mRenderer.setRange(mRenderer.getInitialRange(i), i);
}
}
} else {
XYSeries[] series = ((XYChart) mChart).getDataset().getSeries();
double[] range = null;
int length = series.length;
if (length > 0) {
for (int i = 0; i < scales; i++) {
range = new double[] { MathHelper.NULL_VALUE, -MathHelper.NULL_VALUE,
MathHelper.NULL_VALUE, -MathHelper.NULL_VALUE };
for (int j = 0; j < length; j++) {
if (i == series[j].getScaleNumber()) {
range[0] = Math.min(range[0], series[j].getMinX());
range[1] = Math.max(range[1], series[j].getMaxX());
range[2] = Math.min(range[2], series[j].getMinY());
range[3] = Math.max(range[3], series[j].getMaxY());
}
}
double marginX = Math.abs(range[1] - range[0]) / 40;
double marginY = Math.abs(range[3] - range[2]) / 40;
mRenderer.setRange(new double[] { range[0] - marginX, range[1] + marginX,
range[2] - marginY, range[3] + marginY }, i);
}
}
}
} else {
DefaultRenderer renderer = ((RoundChart) mChart).getRenderer();
renderer.setScale(renderer.getOriginalScale());
}
}