本文整理汇总了Java中org.achartengine.renderer.XYSeriesRenderer.setChartValuesTextSize方法的典型用法代码示例。如果您正苦于以下问题:Java XYSeriesRenderer.setChartValuesTextSize方法的具体用法?Java XYSeriesRenderer.setChartValuesTextSize怎么用?Java XYSeriesRenderer.setChartValuesTextSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.achartengine.renderer.XYSeriesRenderer
的用法示例。
在下文中一共展示了XYSeriesRenderer.setChartValuesTextSize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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();
}
示例6: 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);
}
示例7: 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");
}
示例8: 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);
}
示例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 = 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);
}