Android绘制折线图、柱状图等

来源:点击打开链接

简洁明了~

 很多时候,做一些统计数据,可能放到列表里面看起来不太直观,这个时候借助于折线图,饼状图,柱形图等报表图形展示,即直观,又可以一目了然的明白数据的趋势变化,而且安卓应用,最主要的就是用户和界面交互,一个良好的界面,对用户来说,能起的作用不亚于内存,响应速度等的优化效果。



   

        如何实现一个自定义的折线图呢,当然,你得继承自View,然后写好你的带参构造方法,并且为了考虑以后代码的复用性,把很多能够影响图表的条件都提到全局变量上,这样就能在以后随时随地为你的控件切换不同的皮肤和效果。例如:X轴, Y轴, 线颜色, 点颜色,填充颜色等等


具体代码:

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. private int bgColor = Color.rgb(Integer.parseInt("4d"16),  
  2.         Integer.parseInt("af"16), Integer.parseInt("ea"16));// 整体的背景色  
  3.   
  4. private int singleColumnFillColor = Color.rgb(Integer.parseInt("e7"16),  
  5.         Integer.parseInt("e7"16), Integer.parseInt("e9"16));// 单数列的背景色  
  6.   
  7. private int doubleColumnFillColor = Color.rgb(Integer.parseInt("4d"16),  
  8.         Integer.parseInt("af"16), Integer.parseInt("ea"16));// 单数行的背景色  
  9.   
  10. private int fillDownColor = Color.rgb(Integer.parseInt("45"16),  
  11.         Integer.parseInt("64"16), Integer.parseInt("bf"16));// 填充下面部分的背景色  
  12.   
  13. private int xyLineColor = Color.rgb(Integer.parseInt("a9"16),  
  14.         Integer.parseInt("d8"16), Integer.parseInt("f5"16));// 表格的线颜色  
  15.   
  16. private int chartLineColor = Color.WHITE;// 绘制趋势线的颜色  
  17.   
  18. private int shadowLineColor = Color.rgb(Integer.parseInt("1a"16),  
  19.         Integer.parseInt("49"16), Integer.parseInt("84"16));// 趋势线阴影的颜色  
  20.   
  21. private String yUnit = "";// Y轴单位  
  22.   
  23. private boolean isDrawY = false;// 是否绘制Y轴  
  24.   
  25. private boolean isDrawX = true;// 是否绘制X轴  
  26.   
  27. private boolean isDrawInsideX = true;// 是否绘制内部的X轴  
  28.   
  29. private boolean isDrawInsedeY = false;// 是否绘制内部的Y轴  
  30.   
  31. private boolean isFillDown = false;// 是否填充点的下面部分  
  32.   
  33. private boolean isFillUp = false;// 是否填充点的上面部分(暂未实现)  
  34.   
  35. private boolean isAppendX = true;// X轴是否向左突出一点  
  36.   
  37. private boolean isDemo = true;// 是否demo测试数据  
  38.   
  39. private int ScreenX;// view的宽度  
  40.   
  41. private int ScreenY;// view的高度  
  42.   
  43. private int numberOfX = 6;// 默认X轴放6个值  
  44.   
  45. private int numberOfY = 5;// 默认Y轴放5个值(越多显示的值越精细)  
  46.   
  47. private int paddingTop = 30;// 默认上的padding  
  48.   
  49. private int paddingLeft = 70;// 默认左的padding  
  50.   
  51. private int paddingRight = 30;// 默认右的padding  
  52.   
  53. private int paddingDown = 50;// 默认下的padding  
  54.   
  55. private int appendXLength = 10;// 向左X轴突出的长度  
  56.   
  57. private float maxNumber = 0;// Y轴最大值  
  58.   
  59. private List<List<Float>> pointList;// 传入的数据  
  60.   
  61. private List<Integer> bitmapList;// 传入的点资源id  
  62.   
  63. private List<Integer> lineColorList;// 传入的线颜色  
  64.   
  65. private List<String> titleXList;// 传入的X轴标题  
  66.   
  67. private List<String> titleYList;// 计算得出的Y轴标题  


然后当然就要考虑我们的view需要的大小了,这个时候onmeasure方法就需要登场了,在这里面根据你在layout中为view分配的width和height,得出实际我们要给画布的width和height

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {  
  2.   
  3.        int measuredHeight = measureHeight(heightMeasureSpec);  
  4.   
  5.        int measuredWidth = measureWidth(widthMeasureSpec);  
  6.   
  7.        setMeasuredDimension(measuredWidth, measuredHeight);  
  8.   
  9.        ScreenX = measuredWidth;  
  10.   
  11.        ScreenY = measuredHeight;  
  12.   
  13.    }  
  14.   
  15.    private int measureHeight(int measureSpec) {  
  16.   
  17.        int specMode = MeasureSpec.getMode(measureSpec);  
  18.        int specSize = MeasureSpec.getSize(measureSpec);  
  19.   
  20.        int result = 300;  
  21.        if (specMode == MeasureSpec.AT_MOST) {  
  22.   
  23.            result = specSize;  
  24.        }  
  25.        else if (specMode == MeasureSpec.EXACTLY) {  
  26.   
  27.            result = specSize;  
  28.        }  
  29.   
  30.        return result;  
  31.    }  
  32.   
  33.    private int measureWidth(int measureSpec) {  
  34.        int specMode = MeasureSpec.getMode(measureSpec);  
  35.        int specSize = MeasureSpec.getSize(measureSpec);  
  36.   
  37.        int result = 450;  
  38.        if (specMode == MeasureSpec.AT_MOST) {  
  39.            result = specSize;  
  40.        }  
  41.   
  42.        else if (specMode == MeasureSpec.EXACTLY) {  
  43.   
  44.            result = specSize;  
  45.        }  
  46.   
  47.        return result;  
  48.    }  


接着,就要考虑实现折现图的画布了,也就是ondraw方法,先考虑下拆分折线图;我们可以想下,折线图可以拆成几部分呢?可能看上面定义的全局变量能够发现我这里把折线图表拆分为了

1、最左侧的Y轴

2、最底部的X轴

3、图表内部的Y轴和X轴

4、折线图

5、标记点

这样,我们就明确了我们需要在ondraw里面画什么了(各种draw图形)

1、画Y轴

2、画X轴

3、画内部的X,Y轴

4、画折线

5、画点

当然,明确这一点还不够,因为我们知道在画布中draw的时候需要x和y的位置,这个位置怎么来呢,而且怎么根据外面传进来的值换算成画布中的点

这就需要用数学转换下啦:


计算X轴平均后的坐标

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. private List<Point> initNumberOfX() {  
  2.        int num = (ScreenX - paddingLeft - paddingRight) / (numberOfX - 1);  
  3.        List<Point> list = new ArrayList<Point>();  
  4.        for (int i = 0; i < numberOfX; i++) {  
  5.            Point point = new Point();  
  6.            point.y = ScreenY - paddingDown - paddingTop;  
  7.            point.x = paddingLeft + num * i;  
  8.            list.add(point);  
  9.        }  
  10.        return list;  

计算Y轴平均后的坐标

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. private List<Point> initNumberOfY() {  
  2.        int num = (ScreenY - paddingDown - paddingTop) / (numberOfY - 1);  
  3.        List<Point> list = new ArrayList<Point>();  
  4.        for (int i = 0; i < numberOfY; i++) {  
  5.            Point point = new Point();  
  6.            point.x = ScreenX - paddingLeft - paddingRight;  
  7.            point.y = ScreenY - paddingDown - paddingTop - num * i;  
  8.            list.add(point);  
  9.        }  
  10.        return list;  
  11.    }  

拿到坐标了,这样折现的背景表格框就完全可以画出来了

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. if (isDrawX) {  
  2.            int appendX = 0;  
  3.            if (isAppendX) {  
  4.                appendX = appendXLength;  
  5.            }  
  6.            canvas.drawLine(paddingLeft - appendX, paddingTop + listY.get(0).y, listY.get(0).x  
  7.                    + paddingLeft,  
  8.                    paddingTop + listY.get(0).y, paint);  
  9.        }  
  10.        if (isDrawY) {  
  11.            canvas.drawLine(listX.get(0).x, paddingTop, listX.get(0).x, listX.get(0).y + paddingTop  
  12.                    , paint);  
  13.        }  
  14.        if (isDrawInsedeY) {// 绘制纵向的  
  15.            for (Point point : listX) {  
  16.                if (!isDrawX) {  
  17.                    isDrawX = !isDrawX;  
  18.                    continue;  
  19.                }  
  20.                canvas.drawLine(point.x, paddingTop, point.x, point.y + paddingTop, paint);  
  21.            }  
  22.        }  
  23.        if (isDrawInsideX) {// 绘制横向的  
  24.            for (Point point : listY) {  
  25.                if (!isDrawY) {  
  26.                    isDrawY = !isDrawY;  
  27.                    continue;  
  28.                }  
  29.                int appendX = 0;  
  30.                if (isAppendX) {  
  31.                    appendX = appendXLength;  
  32.                }  
  33.                canvas.drawLine(paddingLeft - appendX, paddingTop + point.y, point.x + paddingLeft,  
  34.                        paddingTop + point.y, paint);  
  35.            }  
  36.        }  


接下来为Y轴找到最大值以及它的每个标题

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. private void setYTitle(List<Point> listY, Canvas canvas) {  
  2.        Paint paint = new Paint();  
  3.        paint.setColor(Color.WHITE);  
  4.        if (pointList == null) {  
  5.            titleYList = new ArrayList<String>();  
  6.            for (int i = 1; i <= numberOfY; i++) {  
  7.                titleYList.add(String.valueOf(100 / i));  
  8.            }  
  9.        } else {  
  10.            for (int i = 0; i < pointList.size(); i++) {  
  11.                for (int j = 0; j < pointList.get(i).size(); j++) {  
  12.   
  13.                    if (pointList.get(i).get(j) > maxNumber) {  
  14.                        maxNumber = pointList.get(i).get(j);  
  15.                    }  
  16.                }  
  17.            }  
  18.            maxNumber = maxNumber + maxNumber / 3;//最大值  
  19.            titleYList = new ArrayList<String>();  
  20.            for (int i = 0; i < numberOfY; i++) {  
  21.                titleYList.add(String.valueOf((int) (0 + i * (maxNumber / (numberOfY - 1)))));  
  22.            }  
  23.        }  
  24.        for (int i = 0; i < numberOfY; i++) {  
  25.            int appendX = 0;  
  26.            if (isAppendX) {  
  27.                appendX = appendXLength;  
  28.            }  
  29.            if (i != 0) {  
  30.                canvas.drawText(titleYList.get(i), paddingLeft - appendX - paddingLeft / 3,  
  31.                        paddingTop  
  32.                                + listY.get(i).y, paint);  
  33.            } else {  
  34.                canvas.drawText(titleYList.get(i) + yUnit,  
  35.                        paddingLeft - appendX - paddingLeft / 3, paddingTop  
  36.                                + listY.get(i).y, paint);  
  37.            }  
  38.        }  
  39.    }  

同样,有了坐标,设置X轴的标题也很简单啦,就不复述了

接着就该考虑怎么将外面传递进来的值转换成图里面的坐标了

[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. private List<List<Point>> countListPosition(List<Point> listX) {  
  2.         List<List<Point>> positionList = new ArrayList<List<Point>>();  
  3.         if (pointList == null) {  
  4.             pointList = new ArrayList<List<Float>>();  
  5.             List<Float> pointInList = new ArrayList<Float>();  
  6.             for (int i = 0; i < numberOfX; i++) {  
  7.                 pointInList.add(0f);  
  8.             }  
  9.             pointList.add(pointInList);  
  10.         }  
  11.         for (int i = 0; i < pointList.size(); i++) {  
  12.             List<Point> positionInList = new ArrayList<Point>();  
  13.             for (int j = 0; j < pointList.get(i).size(); j++) {  
  14.                 Point point = new Point();  
  15.                 Float z = pointList.get(i).get(j);  
  16.                 point.x = listX.get(j).x;  
  17.                 point.y = listX.get(j).y + paddingTop  
  18.                         - (int) ((listX.get(j).y) * (float) z / (float) maxNumber);  
  19.                 positionInList.add(point);  
  20.             }  
  21.             positionList.add(positionInList);  
  22.         }  
  23.         return positionList;  
  24.     }  

这样拿到每个点的坐标后是不是整个折线图就可以画出来了

就是各种drawline啊,draw点啊


[java]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. private void drawChart(Canvas canvas, List<List<Point>> positionList) {  
  2.         Paint paint = new Paint();  
  3.         paint.setAntiAlias(true);  
  4.         paint.setColor(chartLineColor);  
  5.         paint.setStrokeWidth(3);// 默认线宽为3  
  6.         Paint shadowPaint = new Paint();  
  7.         shadowPaint.setAntiAlias(true);  
  8.         shadowPaint.setColor(shadowLineColor);  
  9.         shadowPaint.setStrokeWidth(1);// 默认线宽为3  
  10.         shadowPaint.setAlpha(178);  
  11.         for (int i = 0; i < positionList.size(); i++) {  
  12.             if (lineColorList != null && lineColorList.get(i) != null) {  
  13.                 paint.setColor(lineColorList.get(i));  
  14.             }  
  15.             for (int j = 0; j < positionList.get(i).size() - 1; j++) {  
  16.                 canvas.drawLine(positionList.get(i).get(j).x, positionList.get(i).get(j).y + 2,  
  17.                         positionList.get(i).get(j + 1).x, positionList.get(i).get(j + 1).y + 2,  
  18.                         shadowPaint);//画折线的阴影  
  19.                 canvas.drawLine(positionList.get(i).get(j).x, positionList.get(i).get(j).y,  
  20.                         positionList.get(i).get(j + 1).x, positionList.get(i).get(j + 1).y, paint);//画折现  
  21.             }  
  22.         }  
  23.     }  

这样,一个你自己定义的折线图就出来了,里面还有一些填充,覆盖等draw,通过这些美化后最终实现结果就是:


 


当然:有更好的第三方控件我们也可以使用,例如AChartEngine,这个控件也非常好用滴~


0分源码下载地址:点击打开链接


package com.yzxy.draw; 002 003 import java.util.ArrayList; 004 import java.util.HashMap; 005 import java.util.Iterator; 006 import java.util.Map; 007 import java.util.Set; 008 009 import android.annotation.SuppressLint; 010 import android.content.Context; 011 import android.graphics.Canvas; 012 import android.graphics.Color; 013 import android.graphics.Paint; 014 import android.graphics.Path; 015 import android.graphics.Point; 016 import android.graphics.RectF; 017 import android.graphics.Paint.Style; 018 import android.graphics.Typeface; 019 import android.util.AttributeSet; 020 import android.view.MotionEvent; 021 import android.view.View; 022 023 /** 024 * 025 * @author zhangyayun1@gmail.com 026 * 027 */ 028 @SuppressLint("ViewConstructor") 029 class MyChartView extends View{ 030 031 public static final int RECT_SIZE = 10; 032 private Point mSelectedPoint; 033 034 //枚举实现坐标桌面的样式风格 035 public static enum Mstyle 036 { 037 Line,Curve 038 } 039 040 private Mstyle mstyle=Mstyle.Line; 041 private Point[] mPoints = new Point[100]; 042 043 Context context; 044 int bheight=0; 045 HashMap<Double, Double> map; 046 ArrayList<Double> dlk; 047 int totalvalue=30; 048 int pjvalue=5; 049 String xstr,ystr="";//横纵坐标的属性 050 int margint=15; 051 int marginb=40; 052 int c=0; 053 int resid=0; 054 Boolean isylineshow; 055 056 /** 057 * @param map 需要的数据,虽然key是double,但是只用于排序和显示,与横向距离无关 058 * @param totalvalue Y轴的最大值 059 * @param pjvalue Y平均值 060 * @param xstr X轴的单位 061 * @param ystr Y轴的单位 062 * @param isylineshow 是否显示纵向网格 063 * @return 064 */ 065 public void SetTuView(HashMap<Double, Double> map,int totalvalue,int pjvalue,String xstr,String ystr,Boolean isylineshow) 066 { 067 this.map=map; 068 this.totalvalue=totalvalue; 069 this.pjvalue=pjvalue; 070 this.xstr=xstr; 071 this.ystr=ystr; 072 this.isylineshow=isylineshow; 073 //屏幕横向 074 // act.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); 075 } 076 077 public MyChartView(Context ct) 078 { 079 super(ct); 080 this.context=ct; 081 } 082 083 public MyChartView(Context ct, AttributeSet attrs) 084 { 085 super( ct, attrs ); 086 this.context=ct; 087 } 088 089 public MyChartView(Context ct, AttributeSet attrs, int defStyle) 090 { 091 super( ct, attrs, defStyle ); 092 this.context=ct; 093 } 094 095 @SuppressLint("DrawAllocation") 096 @Override 097 protected void onDraw(Canvas canvas) { 098 super.onDraw(canvas); 099 if(c!=0) 100 this.setbg(c); 101 if(resid!=0) 102 this.setBackgroundResource(resid); 103 dlk=getintfrommap(map); 104 int height=getHeight(); 105 if(bheight==0) 106 bheight=height-marginb; 107 108 int width=getWidth(); 109 int blwidh=dip2px(context,50); 110 int pjsize=totalvalue/pjvalue;//界面布局的尺寸的比例 111 // set up paint 112 Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); 113 paint.setColor(Color.GRAY); 114 paint.setStrokeWidth(1); 115 paint.setStyle(Style.STROKE); 116 for(int i=0;i<pjsize+1;i++)//将顶点的线变为红色的 警戒线 117 { 118 if(i==pjsize) 119 paint.setColor(Color.RED); 120 canvas.drawLine(blwidh,bheight-(bheight/pjsize)*i+margint,width,bheight-(bheight/pjsize)*i+margint, paint);//Y坐标 121 drawline(pjvalue*i+ystr, blwidh/2, bheight-(bheight/pjsize)*i+margint, canvas); 122 } 123 ArrayList<Integer> xlist=new ArrayList<Integer>();//记录每个x的值 124 //画直线(纵向) 125 paint.setColor(Color.GRAY); 126 if(dlk==null) 127 return; 128 for(int i=0;i<dlk.size();i++) 129 { 130 xlist.add(blwidh+(width-blwidh)/dlk.size()*i); 131 if(isylineshow) 132 { 133 canvas.drawLine(blwidh+(width-blwidh)/dlk.size()*i,margint,blwidh+(width-blwidh)/dlk.size()*i,bheight+margint, paint); 134 } 135 drawline(dlk.get(i)+xstr, blwidh+(width-blwidh)/dlk.size()*i, bheight+40, canvas);//X坐标 136 } 137 138 //点的操作设置 139 mPoints=getpoints(dlk, map, xlist, totalvalue, bheight); 140 // Point[] ps=getpoints(dlk, map, xlist, totalvalue, bheight); 141 // mPoints=ps; 142 143 paint.setColor(Color.GREEN); 144 paint.setStyle(Style.STROKE); 145 paint.setStrokeWidth(0); 146 147 if(mstyle==Mstyle.Curve) 148 drawscrollline(mPoints, canvas, paint); 149 else 150 drawline(mPoints, canvas, paint); 151 152 paint.setColor(Color.RED); 153 paint.setStyle(Style.FILL); 154 for (int i=0; i<mPoints.length; i++) 155 { 156 canvas.drawRect(pointToRect(mPoints[i]),paint); 157 } 158 } 159 160 @Override 161 public boolean onTouchEvent(MotionEvent event) 162 { 163 switch (event.getAction()) 164 { 165 case MotionEvent.ACTION_DOWN: 166 for (int i=0; i<mPoints.length; i++) 167 { 168 if (pointToRect(mPoints[i]).contains(event.getX(),event.getY())) 169 { 170 System.out.println("-yes-"+i); 171 mSelectedPoint = mPoints[i]; 172 } 173 } 174 break; 175 case MotionEvent.ACTION_MOVE: 176 if ( null != mSelectedPoint) 177 { 178 // mSelectedPoint.x = (int) event.getX(); 179 mSelectedPoint.y = (int) event.getY(); 180 // invalidate(); 181 } 182 break; 183 case MotionEvent.ACTION_UP: 184 mSelectedPoint = null; 185 break; 186 default: 187 break; 188 } 189 return true; 190 191 } 192 193 194 private RectF pointToRect(Point p) 195 { 196 return new RectF(p.x -RECT_SIZE/2, p.y - RECT_SIZE/2,p.x + RECT_SIZE/2, p.y + RECT_SIZE/2); 197 } 198 199 200 private void drawscrollline(Point[] ps,Canvas canvas,Paint paint) 201 { 202 Point startp=new Point(); 203 Point endp=new Point(); 204 for(int i=0;i<ps.length-1;i++) 205 { 206 startp=ps[i]; 207 endp=ps[i+1]; 208 int wt=(startp.x+endp.x)/2; 209 Point p3=new Point(); 210 Point p4=new Point(); 211 p3.y=startp.y; 212 p3.x=wt; 213 p4.y=endp.y; 214 p4.x=wt; 215 216 Path path = new Path(); 217 path.moveTo(startp.x,startp.y); 218 path.cubicTo(p3.x, p3.y, p4.x, p4.y,endp.x, endp.y); 219 canvas.drawPath(path, paint); 220 221 } 222 } 223 224 225 private void drawline(Point[] ps,Canvas canvas,Paint paint) 226 { 227 Point startp=new Point(); 228 Point endp=new Point(); 229 for(int i=0;i<ps.length-1;i++) 230 { 231 startp=ps[i]; 232 endp=ps[i+1]; 233 canvas.drawLine(startp.x,startp.y,endp.x,endp.y, paint); 234 } 235 } 236 237 238 private Point[] getpoints(ArrayList<Double> dlk,HashMap<Double, Double> map,ArrayList<Integer> xlist,int max,int h) 239 { 240 Point[] points=new Point[dlk.size()]; 241 for(int i=0;i<dlk.size();i++) 242 { 243 int ph=h-(int)(h*(map.get(dlk.get(i))/max)); 244 245 points[i]=new Point(xlist.get(i),ph+margint); 246 } 247 return points; 248 } 249 250 251 private void drawline(String text,int x,int y,Canvas canvas) 252 { 253 Paint p = new Paint(); 254 p.setAlpha(0x0000ff); 255 p.setTextSize(20); 256 String familyName = "宋体"; 257 Typeface font = Typeface.create(familyName,Typeface.ITALIC); 258 p.setTypeface(font); 259 p.setTextAlign(Paint.Align.CENTER); 260 canvas.drawText(text, x, y, p); 261 } 262 263 264 public int dip2px(Context context, float dpValue) 265 { 266 final float scale = context.getResources().getDisplayMetrics().density; 267 return (int) (dpValue * scale + 0.5f); 268 } 269 270 271 public int px2dip(Context context, float pxValue) 272 { 273 final float scale = context.getResources().getDisplayMetrics().density; 274 return (int) (pxValue / scale + 0.5f); 275 } 276 277 278 279 @SuppressWarnings("rawtypes") 280 public ArrayList<Double> getintfrommap(HashMap<Double, Double> map) 281 { 282 ArrayList<Double> dlk=new ArrayList<Double>(); 283 int position=0; 284 if(map==null) 285 return null; 286 Set set= map.entrySet(); 287 Iterator iterator = set.iterator(); 288 289 while(iterator.hasNext()) 290 { 291 @SuppressWarnings("rawtypes") 292 Map.Entry mapentry = (Map.Entry)iterator.next(); 293 dlk.add((Double)mapentry.getKey()); 294 } 295 for(int i=0;i<dlk.size();i++) 296 { 297 int j=i+1; 298 position=i; 299 Double temp=dlk.get(i); 300 for(;j<dlk.size();j++) 301 { 302 if(dlk.get(j)<temp) 303 { 304 temp=dlk.get(j); 305 position=j; 306 } 307 } 308 309 dlk.set(position,dlk.get(i)); 310 dlk.set(i,temp); 311 } 312 return dlk; 313 314 } 315 316 317 318 319 public void setbg(int c) 320 { 321 this.setBackgroundColor(c); 322 } 323 324 public HashMap<Double, Double> getMap() { 325 return map; 326 } 327 328 public void setMap(HashMap<Double, Double> map) { 329 this.map = map; 330 } 331 332 public int getTotalvalue() { 333 return totalvalue; 334 } 335 336 public void setTotalvalue(int totalvalue) { 337 this.totalvalue = totalvalue; 338 } 339 340 public int getPjvalue() { 341 return pjvalue; 342 } 343 344 public void setPjvalue(int pjvalue) { 345 this.pjvalue = pjvalue; 346 } 347 348 public String getXstr() { 349 return xstr; 350 } 351 352 public void setXstr(String xstr) { 353 this.xstr = xstr; 354 } 355 356 public String getYstr() { 357 return ystr; 358 } 359 360 public void setYstr(String ystr) { 361 this.ystr = ystr; 362 } 363 364 public int getMargint() { 365 return margint; 366 } 367 368 public void setMargint(int margint) { 369 this.margint = margint; 370 } 371 372 public Boolean getIsylineshow() { 373 return isylineshow; 374 } 375 376 public void setIsylineshow(Boolean isylineshow) { 377 this.isylineshow = isylineshow; 378 } 379 380 public int getMarginb() { 381 return marginb; 382 } 383 384 public void setMarginb(int marginb) { 385 this.marginb = marginb; 386 } 387 388 public Mstyle getMstyle() { 389 return mstyle; 390 } 391 392 public void setMstyle(Mstyle mstyle) { 393 this.mstyle = mstyle; 394 } 395 396 public int getBheight() { 397 return bheight; 398 } 399 400 public void setBheight(int bheight) { 401 this.bheight = bheight; 402 } 403 404 public int getC() { 405 return c; 406 } 407 408 public void setC(int c) { 409 this.c = c; 410 } 411 412 public int getResid() { 413 return resid; 414 } 415 416 public void setResid(int resid) { 417 this.resid = resid; 418 } 419 420 421 422 }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值