本文整理汇总了Java中org.achartengine.renderer.XYSeriesRenderer.setDisplayChartValues方法的典型用法代码示例。如果您正苦于以下问题:Java XYSeriesRenderer.setDisplayChartValues方法的具体用法?Java XYSeriesRenderer.setDisplayChartValues怎么用?Java XYSeriesRenderer.setDisplayChartValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.achartengine.renderer.XYSeriesRenderer
的用法示例。
在下文中一共展示了XYSeriesRenderer.setDisplayChartValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAlertSeries
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
private void addAlertSeries() {
TimeSeries alertSeries = new TimeSeries("Alerts");
long alertTime = _maxTime - 5000 * 60;
alertSeries.add(alertTime, Long.MAX_VALUE);
alertSeries.add(alertTime, Long.MIN_VALUE);
_dataSet.addSeries(alertSeries);
// create new renderer for the new series
XYSeriesRenderer renderer = new XYSeriesRenderer();
_multipleSeriesRenderer.addSeriesRenderer(renderer);
renderer.setPointStyle(PointStyle.POINT);
renderer.setColor(Color.RED);
renderer.setFillPoints(false);
renderer.setDisplayChartValues(false);
// renderer.setDisplayChartValuesDistance(1);
// renderer.setChartValuesTextSize(30f);
renderer.setShowLegendItem(false);
}
示例2: addSeries
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
private void addSeries(float[] votesarr, int max, XYMultipleSeriesDataset dataSet,
XYMultipleSeriesRenderer multiRenderer, int i, String text,
XYSeriesRenderer renderer) {
XYSeries series = new XYSeries(text);
// Calculate the value in percent
double votes = votesarr[i] * 100 / max;
votes = MathUtils.roundToDecimals(votes, 2);
series.add(i+1, votes);
renderer.setDisplayChartValues(true);
renderer.setChartValuesTextSize(22);
dataSet.addSeries(series);
multiRenderer.addSeriesRenderer(renderer);
multiRenderer.addXTextLabel(i+1, text);
}
示例3: getReportRenderer
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
private XYSeriesRenderer getReportRenderer(int color) {
int displayChartValueDistance = 40;
int lineWidth = 3;
XYSeriesRenderer reportRenderer = new XYSeriesRenderer();
reportRenderer.setPointStyle(PointStyle.CIRCLE);
reportRenderer.setFillPoints(true);
reportRenderer.setColor(color);
reportRenderer.setLineWidth(lineWidth);
reportRenderer.setDisplayChartValues(true);
reportRenderer.setDisplayChartValuesDistance(displayChartValueDistance);
return reportRenderer;
}
示例4: execute
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
/**
* Executes the chart demo.
*
* @param context the context
* @return the built intent
*/
public Intent execute(Context context) {
String[] titles = new String[] { "2007", "2008" };
List<double[]> values = new ArrayList<double[]>();
values.add(new double[] { 5230, 7300, 9240, 10540, 7900, 9200, 12030, 11200, 9500, 10500,
11600, 13500 });
values.add(new double[] { 14230, 12300, 14240, 15244, 15900, 19200, 22030, 21200, 19500, 15500,
12600, 14000 });
int[] colors = new int[] { Color.CYAN, Color.BLUE };
XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
renderer.setOrientation(Orientation.VERTICAL);
setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.5,
12.5, 0, 24000, Color.GRAY, Color.LTGRAY);
renderer.setXLabels(1);
renderer.setYLabels(10);
renderer.addXTextLabel(1, "Jan");
renderer.addXTextLabel(3, "Mar");
renderer.addXTextLabel(5, "May");
renderer.addXTextLabel(7, "Jul");
renderer.addXTextLabel(10, "Oct");
renderer.addXTextLabel(12, "Dec");
int length = renderer.getSeriesRendererCount();
for (int i = 0; i < length; i++) {
XYSeriesRenderer seriesRenderer = (XYSeriesRenderer) renderer.getSeriesRendererAt(i);
seriesRenderer.setDisplayChartValues(true);
}
return ChartFactory.getBarChartIntent(context, buildBarDataset(titles, values), renderer,
Type.DEFAULT);
}
示例5: buildXYSeriesRender
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
protected XYSeriesRenderer buildXYSeriesRender(int color, PointStyle style){
XYSeriesRenderer renderer = new XYSeriesRenderer();
renderer.setColor(color);
renderer.setPointStyle(style);
renderer.setFillPoints(true);
renderer.setDisplayChartValues(true);
//Chaning size in graph
renderer.setLineWidth(3);
renderer.setChartValuesTextSize(25.0f);
return renderer;
}
示例6: buildXYSeriesRender
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
protected XYSeriesRenderer buildXYSeriesRender(int color, PointStyle style){
XYSeriesRenderer renderer = new XYSeriesRenderer();
renderer.setColor(color);
renderer.setPointStyle(style);
renderer.setFillPoints(true);
renderer.setDisplayChartValues(true);
//Chaning size in graph
renderer.setLineWidth(3);
renderer.setChartValuesTextSize(25.0f);
renderer.setAnnotationsTextSize(20.0f);
return renderer;
}
示例7: customization
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
XYSeriesRenderer customization(String color) {
XYSeriesRenderer renderer = new XYSeriesRenderer();
renderer.setColor(Color.parseColor(color));
renderer.setDisplayChartValues(true);
renderer.setChartValuesTextSize(val);
return renderer;
}
示例8: onActivityCreated
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Log.d(TAG, "onActivityCreated");
mViewZoomIn = getActivity().findViewById(R.id.zoom_in);
mViewZoomOut = getActivity().findViewById(R.id.zoom_out);
mViewZoomReset = getActivity().findViewById(R.id.zoom_reset);
mViewZoomIn.setOnClickListener(this);
mViewZoomOut.setOnClickListener(this);
mViewZoomReset.setOnClickListener(this);
pulseSeries = new TimeSeries("Pulse");
if (mPulses.size() > 0) {
for (Pulse p : mPulses) {
pulseSeries.add(new Date(p.getTime()), p.getValue());
}
}
mDataset.addSeries(pulseSeries);
// graph itself
XYSeriesRenderer pulseRenderer = new XYSeriesRenderer();
pulseRenderer.setDisplayChartValues(true);
pulseRenderer.setChartValuesTextSize(25);
pulseRenderer.setPointStyle(PointStyle.CIRCLE);
pulseRenderer.setColor(Color.RED);
pulseRenderer.setFillPoints(true);
pulseRenderer.setLineWidth(3);
mRenderer.addSeriesRenderer(pulseRenderer);
maxXRange = pulseSeries.getMaxX();
minXRange = pulseSeries.getMinX();
}
示例9: execute
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
/**
* Executes the chart demo.
*
* @param context the context
* @return the built intent
*/
public Intent execute(Context context) {
String[] titles = new String[] { "Sales for 2008", "Sales for 2007",
"Difference between 2008 and 2007 sales" };
List<double[]> values = new ArrayList<double[]>();
values.add(new double[] { 14230, 12300, 14240, 15244, 14900, 12200, 11030, 12000, 12500, 15500,
14600, 15000 });
values.add(new double[] { 10230, 10900, 11240, 12540, 13500, 14200, 12530, 11200, 10500, 12500,
11600, 13500 });
int length = values.get(0).length;
double[] diff = new double[length];
for (int i = 0; i < length; i++) {
diff[i] = values.get(0)[i] - values.get(1)[i];
}
values.add(diff);
int[] colors = new int[] { Color.BLUE, Color.CYAN, Color.GREEN };
PointStyle[] styles = new PointStyle[] { PointStyle.POINT, PointStyle.POINT, PointStyle.POINT };
XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.75,
12.25, -5000, 19000, Color.GRAY, Color.LTGRAY);
renderer.setXLabels(12);
renderer.setYLabels(10);
renderer.setChartTitleTextSize(20);
renderer.setTextTypeface("sans_serif", Typeface.BOLD);
renderer.setLabelsTextSize(14f);
renderer.setAxisTitleTextSize(15);
renderer.setLegendTextSize(15);
length = renderer.getSeriesRendererCount();
for (int i = 0; i < length; i++) {
XYSeriesRenderer seriesRenderer = (XYSeriesRenderer) renderer.getSeriesRendererAt(i);
if (i == length - 1) {
FillOutsideLine fill = new FillOutsideLine(FillOutsideLine.Type.BOUNDS_ALL);
fill.setColor(Color.GREEN);
seriesRenderer.addFillOutsideLine(fill);
}
seriesRenderer.setLineWidth(2.5f);
seriesRenderer.setDisplayChartValues(true);
seriesRenderer.setChartValuesTextSize(10f);
}
return ChartFactory.getCubicLineChartIntent(context, buildBarDataset(titles, values), renderer,
0.5f);
}
示例10: execute
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
/**
* Executes the chart demo.
*
* @param context the context
* @return the built intent
*/
public Intent execute(Context context) {
double[] minValues = new double[] { -24, -19, -10, -1, 7, 12, 15, 14, 9, 1, -11, -16 };
double[] maxValues = new double[] { 7, 12, 24, 28, 33, 35, 37, 36, 28, 19, 11, 4 };
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
RangeCategorySeries series = new RangeCategorySeries("Temperature");
int length = minValues.length;
for (int k = 0; k < length; k++) {
series.add(minValues[k], maxValues[k]);
}
dataset.addSeries(series.toXYSeries());
int[] colors = new int[] { Color.CYAN };
XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
setChartSettings(renderer, "Monthly temperature range", "Month", "Celsius degrees", 0.5, 12.5,
-30, 45, Color.GRAY, Color.LTGRAY);
renderer.setBarSpacing(0.5);
renderer.setXLabels(0);
renderer.setYLabels(10);
renderer.addXTextLabel(1, "Jan");
renderer.addXTextLabel(3, "Mar");
renderer.addXTextLabel(5, "May");
renderer.addXTextLabel(7, "Jul");
renderer.addXTextLabel(10, "Oct");
renderer.addXTextLabel(12, "Dec");
renderer.addYTextLabel(-25, "Very cold");
renderer.addYTextLabel(-10, "Cold");
renderer.addYTextLabel(5, "OK");
renderer.addYTextLabel(20, "Nice");
renderer.setMargins(new int[] {30, 70, 10, 0});
renderer.setYLabelsAlign(Align.RIGHT);
XYSeriesRenderer r = (XYSeriesRenderer) renderer.getSeriesRendererAt(0);
r.setDisplayChartValues(true);
r.setChartValuesTextSize(12);
r.setChartValuesSpacing(3);
r.setGradientEnabled(true);
r.setGradientStart(-20, Color.BLUE);
r.setGradientStop(20, Color.GREEN);
return ChartFactory.getRangeBarChartIntent(context, dataset, renderer, Type.DEFAULT,
"Temperature range");
}
示例11: execute
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
/**
* Executes the chart demo.
*
* @param context the context
* @return the built intent
*/
public Intent execute(Context context) {
String[] titles = new String[] { "New tickets", "Fixed tickets" };
List<Date[]> dates = new ArrayList<Date[]>();
List<double[]> values = new ArrayList<double[]>();
int length = titles.length;
for (int i = 0; i < length; i++) {
dates.add(new Date[12]);
dates.get(i)[0] = new Date(108, 9, 1);
dates.get(i)[1] = new Date(108, 9, 8);
dates.get(i)[2] = new Date(108, 9, 15);
dates.get(i)[3] = new Date(108, 9, 22);
dates.get(i)[4] = new Date(108, 9, 29);
dates.get(i)[5] = new Date(108, 10, 5);
dates.get(i)[6] = new Date(108, 10, 12);
dates.get(i)[7] = new Date(108, 10, 19);
dates.get(i)[8] = new Date(108, 10, 26);
dates.get(i)[9] = new Date(108, 11, 3);
dates.get(i)[10] = new Date(108, 11, 10);
dates.get(i)[11] = new Date(108, 11, 17);
}
values.add(new double[] { 142, 123, 142, 152, 149, 122, 110, 120, 125, 155, 146, 150 });
values.add(new double[] { 102, 90, 112, 105, 125, 112, 125, 112, 105, 115, 116, 135 });
length = values.get(0).length;
int[] colors = new int[] { Color.BLUE, Color.GREEN };
PointStyle[] styles = new PointStyle[] { PointStyle.POINT, PointStyle.POINT };
XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
setChartSettings(renderer, "Project work status", "Date", "Tickets", dates.get(0)[0].getTime(),
dates.get(0)[11].getTime(), 50, 190, Color.GRAY, Color.LTGRAY);
renderer.setXLabels(0);
renderer.setYLabels(10);
renderer.addYTextLabel(100, "test");
length = renderer.getSeriesRendererCount();
for (int i = 0; i < length; i++) {
XYSeriesRenderer seriesRenderer = (XYSeriesRenderer) renderer.getSeriesRendererAt(i);
seriesRenderer.setDisplayChartValues(true);
}
renderer.setXRoundedLabels(false);
return ChartFactory.getTimeChartIntent(context, buildDateDataset(titles, dates, values),
renderer, "MM/dd/yyyy");
}
示例12: draw
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void draw() {
ArrayList<String> dates;
ArrayList<Double> readings;
// assign the data passed to the intent
dates = getIntent().getStringArrayListExtra("dates");
readings = (ArrayList<Double>) getIntent().getSerializableExtra(
"readings");
title = getIntent().getStringExtra("test");
// create a new time series for the graph
TimeSeries series = new TimeSeries(title + " Results");
// populate the series with data retrieved from the database
for (int i = dates.size() - 1; i >= 0; i--) {
// parse the date object to calendar date time
try {
c.setTime(sdf.parse(dates.get(i)));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// add the current point to the time series
series.add(c.getTime(), readings.get(i));
}
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
dataset.addSeries(series); // initialize the set of data to be drawn
// Now create the renderer to control how the chart looks like
XYSeriesRenderer renderer = new XYSeriesRenderer();
renderer.setLineWidth(4);
renderer.setColor(Color.WHITE);
// add point markers
renderer.setPointStyle(PointStyle.CIRCLE);
renderer.setPointStrokeWidth(3);
renderer.setDisplayChartValues(true);
XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
mRenderer.addSeriesRenderer(renderer);
// avoid black border
mRenderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00)); // transparent
// margins
// Enable Pan on two axis
mRenderer.setPanEnabled(true, true);
mRenderer.setShowGrid(true); // show the grid
mRenderer.setXTitle("Day");
if (title.equals("HBA1C"))
mRenderer.setYTitle("%");
else
mRenderer.setYTitle("mg/dl");
mRenderer.setZoomButtonsVisible(true);
GraphicalView chartView = ChartFactory.getTimeChartView(DrawGraph.this,
dataset, mRenderer, "yyyy/MM/dd hh:mm aa");// combines the dataset with
// the renderer and returns
// a view
LinearLayout chart_container = (LinearLayout) findViewById(R.id.Chart_layout);
//set the created chart view to the linear layout of the layout created for the graph
chart_container.addView(chartView, 0);
}
示例13: init
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
private void init() {
mCardLabel = (TextView) findViewById(R.id.card_textView);
mStatsLabel = (TextView) findViewById(R.id.stats_textView);
mChartLayout = (FrameLayout) findViewById(R.id.chart_frameLayout);
statsRelativeLayout = (RelativeLayout) findViewById(R.id.stats_relativelayout);
mCorrectColor = getResources().getColor(R.color.holo_green);
mWrongColor = getResources().getColor(R.color.holo_red);
correctRenderer = new XYSeriesRenderer();
wrongRenderer = new XYSeriesRenderer();
correctRenderer.setColor(mCorrectColor);
correctRenderer.setDisplayChartValues(false);
wrongRenderer.setColor(mWrongColor);
wrongRenderer.setDisplayChartValues(false);
barRenderer = new XYMultipleSeriesRenderer();
barRenderer.addSeriesRenderer(correctRenderer);
barRenderer.addSeriesRenderer(wrongRenderer);
barRenderer.setZoomEnabled(false, false);
barRenderer.setPanEnabled(false);
barRenderer.setBarSpacing(1d);
barRenderer.setXAxisMin(.5);
barRenderer.setYAxisMin(.5);
barRenderer.setXAxisMax(1.5);
barRenderer.setBarWidth(dpToPixels(90));
barRenderer.setLegendTextSize(spToPixels(14));
barRenderer.setLegendHeight(spToPixels(14));
barRenderer.setShowLegend(false);
barRenderer.setApplyBackgroundColor(true);
barRenderer.setBackgroundColor(Color.TRANSPARENT);
barRenderer.setOrientation(XYMultipleSeriesRenderer.Orientation.VERTICAL);
barRenderer.setMargins(new int[]{0, 0, 0, 0});
if (!Themes.get(getContext()).isThemeDark()) {
barRenderer.setMarginsColor(Color.WHITE);
} else {
barRenderer.setMarginsColor(getResources().getColor(R.color.dark_card_bg));
}
barRenderer.setXLabels(0);
barRenderer.setYLabels(0);
setThemeParams();
mInitialized = true;
}
示例14: openChart
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
private void openChart(){
XYSeries durationSeries = new XYSeries("Duration of travel");
int timeLength = trafficStatList.size();
for(int i = 0; i < timeLength; i++){
durationSeries.add((i + 1), trafficStatList.get(i).getTravelTime());
}
XYSeries speedSeries = new XYSeries("Speed");
for(int i = 0; i < timeLength; i++){
speedSeries.add((i + 1), trafficStatList.get(i).getSpeed());
}
//Collects all series and adds them under one object here called data
XYMultipleSeriesDataset data = new XYMultipleSeriesDataset();
data.addSeries(durationSeries);
data.addSeries(speedSeries);
//Gives the Bar it's property
XYSeriesRenderer durRenderer = new XYSeriesRenderer();
durRenderer.setColor(Color.GREEN);
durRenderer.setDisplayChartValues(true);
durRenderer.setChartValuesTextAlign(Paint.Align.CENTER);
durRenderer.setChartValuesTextSize(15);
XYSeriesRenderer speedRenderer = new XYSeriesRenderer();
speedRenderer.setColor(Color.CYAN);
speedRenderer.setDisplayChartValues(true);
speedRenderer.setChartValuesTextAlign(Paint.Align.CENTER);
speedRenderer.setChartValuesTextSize(15);
XYMultipleSeriesRenderer mRender = new XYMultipleSeriesRenderer();
mRender.setBarSpacing(1);
mRender.addSeriesRenderer(durRenderer);
mRender.addSeriesRenderer(speedRenderer);
mRender.setChartTitle("Travel Time and Speed");
mRender.setXTitle("Departure Time");
mRender.setYTitle("Duration and Speed");
mRender.setZoomButtonsVisible(true);
mRender.setLabelsTextSize(20);
mRender.setLegendTextSize(15);
mRender.setChartTitleTextSize(28);
mRender.setAxisTitleTextSize(25);
mRender.setXAxisMin(trafficStatList.get(1).getHour());
mRender.setXAxisMax(trafficStatList.size());
for (int i = 0; i < timeLength; i++)
{
mRender.addTextLabel(i + 1, String.valueOf((int) trafficStatList.get(i).getHour() + ":" + (int) trafficStatList.get(i).getMinutes() ));
}
mRender.setXLabelsAlign(CENTER);
mRender.setXLabels(0);
// Getting a reference to LinearLayout of the MainActivity Layout
LinearLayout chartContainer = (LinearLayout) findViewById(R.id.chart_container);
// Creating a Time Chart
mChart = (GraphicalView) ChartFactory.getBarChartView(getBaseContext(), data, mRender, BarChart.Type.DEFAULT);
//return intent;
mRender.setClickEnabled(true);
mRender.setSelectableBuffer(10);
mChart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SeriesSelection seriesSelection = mChart.getCurrentSeriesAndPoint();
if (seriesSelection != null) {
int seriesIndex = seriesSelection.getSeriesIndex();
String selectedSeries = "Duration";
if(seriesIndex==0)
selectedSeries = "Duration";
else
selectedSeries = "Speed";
}
}
});
chartContainer.addView(mChart);
}
示例15: execute
import org.achartengine.renderer.XYSeriesRenderer; //导入方法依赖的package包/类
/**
* Executes the chart demo.
*
* @param context the context
* @return the built intent
*/
public Intent execute(Context context) {
String[] titles = new String[] { "Sales for 2008", "Sales for 2007",
"Difference between 2008 and 2007 sales" };
List<double[]> values = new ArrayList<double[]>();
values.add(new double[] { 14230, 12300, 14240, 15244, 14900, 12200, 11030, 12000, 12500, 15500,
14600, 15000 });
values.add(new double[] { 10230, 10900, 11240, 12540, 13500, 14200, 12530, 11200, 10500, 12500,
11600, 13500 });
int length = values.get(0).length;
double[] diff = new double[length];
for (int i = 0; i < length; i++) {
diff[i] = values.get(0)[i] - values.get(1)[i];
}
values.add(diff);
int[] colors = new int[] { Color.BLUE, Color.CYAN, Color.GREEN };
PointStyle[] styles = new PointStyle[] { PointStyle.POINT, PointStyle.POINT, PointStyle.POINT };
XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
setChartSettings(renderer, "Monthly sales in the last 2 years", "Month", "Units sold", 0.75,
12.25, -5000, 19000, Color.GRAY, Color.LTGRAY);
renderer.setXLabels(12);
renderer.setYLabels(10);
renderer.setChartTitleTextSize(20);
renderer.setTextTypeface("sans_serif", Typeface.BOLD);
renderer.setLabelsTextSize(14f);
renderer.setAxisTitleTextSize(15);
renderer.setLegendTextSize(15);
length = renderer.getSeriesRendererCount();
for (int i = 0; i < length; i++) {
XYSeriesRenderer seriesRenderer = (XYSeriesRenderer) renderer.getSeriesRendererAt(i);
if (i == length - 1) {
FillOutsideLine fill = FillOutsideLine.BOUNDS_ALL;
fill.setColor(Color.GREEN);
seriesRenderer.addFillOutsideLine(fill);
}
seriesRenderer.setLineWidth(2.5f);
seriesRenderer.setDisplayChartValues(true);
seriesRenderer.setChartValuesTextSize(10f);
}
return ChartFactory.getCubicLineChartIntent(context, buildBarDataset(titles, values), renderer,
0.5f);
}