Skip to content

Commit 3d6c7fe

Browse files
committed
增加竖图左轴标签文本多行显示功能
1 parent 59f611b commit 3d6c7fe

File tree

182 files changed

+32804
-208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+32804
-208
lines changed

.metadata/.log

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,3 +385,69 @@ This warning can be switched off on the Team > Git > Confirmations and Warnings
385385

386386
!ENTRY org.eclipse.jdt.core 4 0 2014-07-02 20:05:39.826
387387
!MESSAGE Invalid ZIP archive: E:\GitHub\GitHub\XCL-Charts\XCL-Charts\bin\xcl-charts.jar
388+
!SESSION 2014-07-03 09:53:42.197 -----------------------------------------------
389+
eclipse.buildId=v22.0.5-757759
390+
java.version=1.7.0_07
391+
java.vendor=Oracle Corporation
392+
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN
393+
Framework arguments: -product com.android.ide.eclipse.adt.package.product
394+
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product com.android.ide.eclipse.adt.package.product
395+
396+
!ENTRY org.eclipse.egit.ui 2 0 2014-07-03 09:54:24.679
397+
!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level
398+
Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory.
399+
The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in
400+
this system level configuration. The Git installation location can be configured on the
401+
Team > Git > Configuration preference page's 'System Settings' tab.
402+
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
403+
404+
!ENTRY org.eclipse.egit.ui 2 0 2014-07-03 09:54:24.800
405+
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
406+
user global configuration and to define the default location to store repositories: 'C:\Users\XCL'. If this is
407+
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
408+
EGit might behave differently since they see different configuration options.
409+
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
410+
!SESSION 2014-07-03 18:58:11.156 -----------------------------------------------
411+
eclipse.buildId=v22.0.5-757759
412+
java.version=1.7.0_07
413+
java.vendor=Oracle Corporation
414+
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN
415+
Framework arguments: -product com.android.ide.eclipse.adt.package.product
416+
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product com.android.ide.eclipse.adt.package.product
417+
418+
!ENTRY org.eclipse.egit.ui 2 0 2014-07-03 18:59:46.691
419+
!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level
420+
Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory.
421+
The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in
422+
this system level configuration. The Git installation location can be configured on the
423+
Team > Git > Configuration preference page's 'System Settings' tab.
424+
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
425+
426+
!ENTRY org.eclipse.egit.ui 2 0 2014-07-03 18:59:46.883
427+
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
428+
user global configuration and to define the default location to store repositories: 'C:\Users\XCL'. If this is
429+
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
430+
EGit might behave differently since they see different configuration options.
431+
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
432+
!SESSION 2014-07-03 22:22:53.239 -----------------------------------------------
433+
eclipse.buildId=v22.0.5-757759
434+
java.version=1.7.0_07
435+
java.vendor=Oracle Corporation
436+
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN
437+
Framework arguments: -product com.android.ide.eclipse.adt.package.product
438+
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product com.android.ide.eclipse.adt.package.product
439+
440+
!ENTRY org.eclipse.egit.ui 2 0 2014-07-03 22:23:43.287
441+
!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level
442+
Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory.
443+
The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in
444+
this system level configuration. The Git installation location can be configured on the
445+
Team > Git > Configuration preference page's 'System Settings' tab.
446+
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
447+
448+
!ENTRY org.eclipse.egit.ui 2 0 2014-07-03 22:23:43.301
449+
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
450+
user global configuration and to define the default location to store repositories: 'C:\Users\XCL'. If this is
451+
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
452+
EGit might behave differently since they see different configuration options.
453+
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

.metadata/.plugins/org.eclipse.cdt.core/.log

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
*** SESSION 7月 02, 2014 10:41:51.03 --------------------------------------------
88
*** SESSION 7月 02, 2014 16:34:09.89 --------------------------------------------
99
*** SESSION 7月 02, 2014 20:04:51.57 --------------------------------------------
10+
*** SESSION 7月 03, 2014 09:54:25.03 --------------------------------------------
11+
*** SESSION 7月 03, 2014 18:59:47.47 --------------------------------------------
12+
*** SESSION 7月 03, 2014 22:23:43.55 --------------------------------------------
Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
/**
2+
* Copyright 2014 XCL-Charts
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* @Project XCL-Charts
17+
* @Description Android图表基类库
18+
* @author XiongChuanLiang<br/>(xcl_168@aliyun.com)
19+
* @license http://www.apache.org/licenses/ Apache v2 License
20+
* @version 1.0
21+
*/
22+
package org.xclcharts.renderer;
23+
24+
import org.xclcharts.common.IFormatterDoubleCallBack;
25+
26+
import android.graphics.Color;
27+
import android.graphics.Paint;
28+
import android.graphics.Paint.Align;
29+
import android.graphics.Paint.Style;
30+
import android.util.Log;
31+
32+
/**
33+
* @ClassName RdChart
34+
* @Description 这是雷达图,极限图等图的基类
35+
* @author XiongChuanLiang<br/>(xcl_168@aliyun.com)
36+
*
37+
*/
38+
39+
public class RdChart extends XChart {
40+
41+
private String TAG = "RdChart";
42+
43+
//半径
44+
private float mRadius=0.0f;
45+
//初始偏移角度
46+
private int mOffsetAgent = 0;//180;
47+
48+
//绘制Key的画笔
49+
private Paint mPaintKey = null;
50+
//是否显示Key
51+
private boolean mKeyVisible = true;
52+
53+
//格式化线中点的标签显示
54+
private IFormatterDoubleCallBack mDotLabelFormatter;
55+
56+
57+
//开放标签和线画笔让用户设置
58+
private Paint mPaintLabel = null;
59+
private Paint mPaintLine = null;
60+
61+
62+
public RdChart() {
63+
super();
64+
initChart();
65+
}
66+
67+
private void initChart() {
68+
mPaintKey = new Paint();
69+
mPaintKey.setColor(Color.BLACK);
70+
mPaintKey.setTextSize(18);
71+
mPaintKey.setStyle(Style.FILL);
72+
mPaintKey.setAntiAlias(true);
73+
74+
mPaintLabel = new Paint();
75+
mPaintLabel.setColor(Color.BLACK);
76+
mPaintLabel.setTextSize(18);
77+
mPaintLabel.setAntiAlias(true);
78+
mPaintLabel.setTextAlign(Align.CENTER);
79+
80+
mPaintLine = new Paint();
81+
mPaintLine.setColor((int)Color.rgb(180, 205, 230));
82+
mPaintLine.setAntiAlias(true);
83+
mPaintLine.setStyle(Style.STROKE);
84+
mPaintLine.setStrokeWidth(3);
85+
86+
}
87+
88+
@Override
89+
protected void calcPlotRange()
90+
{
91+
super.calcPlotRange();
92+
93+
if(isVerticalScreen())
94+
{
95+
this.mRadius = this.plotArea.getWidth() / 2;
96+
}else{
97+
this.mRadius = this.plotArea.getHeight() / 2;
98+
}
99+
}
100+
101+
/**
102+
* 设置饼图(pie chart)的半径
103+
* @param radius 饼图的半径
104+
*/
105+
public void setRadius(final float radius)
106+
{
107+
if(agent < 0 || agent > 360)
108+
{
109+
Log.e(TAG, "起始偏移角度不能小于0或大于360");
110+
}else
111+
mRadius = radius;
112+
}
113+
114+
/**
115+
* 返回半径
116+
* @return 半径
117+
*/
118+
public float getRadius()
119+
{
120+
return mRadius;
121+
}
122+
123+
/**
124+
* 设置图起始偏移角度
125+
* @param agent 偏移角度
126+
*/
127+
public void setInitialAngle(final int agent)
128+
{
129+
if(agent < 0 || agent > 360)
130+
{
131+
Log.e(TAG, "起始偏移角度不能小于0或大于360");
132+
}else
133+
mOffsetAgent = agent;
134+
}
135+
136+
137+
/**
138+
* 返回图的起始偏移角度
139+
* @return 偏移角度
140+
*/
141+
public int getInitialAngle()
142+
{
143+
return mOffsetAgent;
144+
}
145+
146+
147+
/**
148+
* 设置线上点标签显示格式
149+
*
150+
* @param callBack
151+
* 回调函数
152+
*/
153+
public void setDotLabelFormatter(IFormatterDoubleCallBack callBack) {
154+
this.mDotLabelFormatter = callBack;
155+
}
156+
157+
/**
158+
* 返回线上点标签显示格式
159+
*
160+
* @param value 传入当前值
161+
* @return 显示格式
162+
*/
163+
protected String getFormatterDotLabel(double value) {
164+
String itemLabel = "";
165+
try {
166+
itemLabel = mDotLabelFormatter.doubleFormatter(value);
167+
} catch (Exception ex) {
168+
itemLabel = Double.toString(value);
169+
// DecimalFormat df=new DecimalFormat("#0");
170+
// itemLabel = df.format(value).toString();
171+
}
172+
return itemLabel;
173+
}
174+
175+
176+
/**
177+
* 开放Key画笔
178+
* @return 画笔
179+
*/
180+
public Paint getKeyPaint()
181+
{
182+
return mPaintKey;
183+
}
184+
185+
/**
186+
* 是否绘制Key
187+
* @return Key值
188+
*/
189+
public boolean getKeyVisible()
190+
{
191+
return mKeyVisible;
192+
}
193+
194+
/**
195+
* 在图的上方显示键值(key)的标签说明
196+
*
197+
*/
198+
public void showKeyLabels()
199+
{
200+
mKeyVisible = true;
201+
}
202+
203+
/**
204+
* 在图的上方不显示键值(key)的标签说明
205+
*/
206+
public void hideKeyLabels()
207+
{
208+
mKeyVisible = false;
209+
}
210+
211+
212+
213+
/**
214+
* 开放标签画笔
215+
* @return 画笔
216+
*/
217+
public Paint getLabelPaint()
218+
{
219+
return mPaintLabel;
220+
}
221+
222+
/**
223+
* 开放画网线的画笔
224+
* @return 画笔
225+
*/
226+
public Paint getLinePaint()
227+
{
228+
return mPaintLine;
229+
}
230+
231+
232+
}

0 commit comments

Comments
 (0)