public class ChartBaseUtils
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
BOLD |
static java.lang.String |
ITALIC |
static java.lang.String |
PT |
构造器和说明 |
---|
ChartBaseUtils() |
限定符和类型 | 方法和说明 |
---|---|
static java.lang.String |
addImageAsEmb(java.awt.Image image)
将图片做为内部资源添加
|
static java.lang.String |
addImageAsEmb(java.awt.Image image,
java.lang.String sessionID) |
static JSONObject |
background2JS(Repository repo,
Background background)
将背景处理成js端的格式.
|
static java.lang.Object |
cloneObject(java.lang.Object object)
封装的特殊数据类型的Object克隆,此Object会传入以下类型:公式、字符串、空值。
|
static java.awt.Color[] |
createColorsWithAlpha(java.awt.Color color,
int count)
根据透明度变化100%--60%之间均匀变化, 个数为count
|
static java.awt.Color[] |
createColorsWithHSB(java.awt.Color color,
int count)
根据hsb变化得到cout个颜色
|
static java.awt.Color[] |
createFillColorArray(AttrFillStyle fillStyle,
int seriesCount)
根据颜色(单色, 双色 或者默认) 创建填充的颜色数组.
|
static double |
date2Int(java.util.Date date,
int dayType)
kunsnat:
将日期转化为 年月份相加的int数值: 20100802; // 转为为对比: 19000101的天数差
默认的都是精确到秒级别的.
|
static java.lang.String |
dealLabelStringAutoWrap(java.lang.String labelString,
TextAttr textAttr,
int resolution,
double maxWidth)
将文字根据指定宽度换行,不考虑中英文
|
static java.lang.String |
format2JS(java.text.Format format)
将 格式 转为js端的格式类型.
|
static java.lang.String |
format2JS(java.text.Format format,
Repository repo)
将 格式 转为js端的格式类型.
|
static java.lang.Number |
formula2Number(BaseFormula formula)
处理公式 将结果变为数字Number.
|
static java.lang.Number |
formula2Number(BaseFormula formula,
double diffWithTimeZone)
处理公式 将结果变为数字Number.
|
static java.lang.String |
generalFormat(double number)
常规格式的数值处理, 去掉后缀0
比如: 20.0 ----> 20, 20.1000000 --> 20.1
|
static java.lang.String |
generalPath2Android(java.awt.geom.GeneralPath path)
拼接字符串, 用于安卓的解析, 避过json(安卓json解析太慢, 消耗)
x == > "10_11_22"
y == > "10_11_22"
types ==> "1_0_3_3"
ctrls ==> " _ _ _ _ " "_ _ 21qt22 _" " _ _ 31ct21ct31ct11ct_ "
最终结果为: x _pt_ y _pt_ types _pt_ ctrls
|
static JSONObject |
generalPath2JS(java.awt.geom.GeneralPath path)
frank: 地图形状服务器转化js传到浏览器
|
static JSONObject |
getCSSFontJSON(FRFont font,
Repository repo) |
static JSONObject |
getCSSFontJSONWithFont(FRFont font) |
static java.lang.Object |
getObject(int index,
java.lang.Object[] objArray)
获取数组中序号为Index的Object,
如果index大于数组的size, 对size取余.
|
static AttrFillStyle |
getServerFillStyle(AttrFillStyle fillStyle) |
static void |
image2JS(Repository repo,
JSONObject js,
java.awt.Image image)
kunsnat: 将图片转为base64格式的字符串 dataUrl 在js端加载
|
static java.util.Date |
long2Date(long number,
int dateType)
long型的数据转为日期型
kunsnat: 一般在单元格过来的数值 都是精确到秒级别的.
|
static java.awt.geom.RectangularShape |
rectangle2RoundRectangle(java.awt.geom.Rectangle2D bounds,
boolean isTo)
矩形 根据参数决定返回矩形或圆角矩形
|
static java.awt.geom.RectangularShape |
rectangle2RoundRectangle(java.awt.geom.Rectangle2D bounds,
double roundRadius)
返回圆角矩形
|
static java.awt.Color |
saturationDown(java.awt.Color color)
降低颜色的饱和度
|
static java.awt.image.BufferedImage |
shapeToImage(java.awt.Shape shape,
int strokeSize)
shape转为同样可见形状的image
|
public static final java.lang.String PT
public static final java.lang.String BOLD
public static final java.lang.String ITALIC
public static java.lang.String dealLabelStringAutoWrap(java.lang.String labelString, TextAttr textAttr, int resolution, double maxWidth)
labelString
- 字符串textAttr
- 文本格式resolution
- 分辨率maxWidth
- 最大宽度public static JSONObject getCSSFontJSONWithFont(FRFont font) throws JSONException
JSONException
public static JSONObject getCSSFontJSON(FRFont font, Repository repo) throws JSONException
JSONException
public static java.lang.Number formula2Number(BaseFormula formula)
formula
- 处理的公式对象public static java.lang.Number formula2Number(BaseFormula formula, double diffWithTimeZone)
formula
- 处理的公式对象public static JSONObject generalPath2JS(java.awt.geom.GeneralPath path) throws JSONException
path
- 转换为js数据的GeneralPath对象JSONException
public static java.lang.String generalPath2Android(java.awt.geom.GeneralPath path)
path
- 路径public static java.awt.Color saturationDown(java.awt.Color color)
color
- 要降低饱和度的颜色对象public static java.awt.Color[] createFillColorArray(AttrFillStyle fillStyle, int seriesCount)
fillStyle
- 填充条件seriesCount
- 需要的填充颜色个数public static java.awt.Color[] createColorsWithAlpha(java.awt.Color color, int count)
count
- 均匀变化的颜色个数color
- 加入透明度的原始颜色public static java.awt.Color[] createColorsWithHSB(java.awt.Color color, int count)
color
- 变化的基础颜色count
- 颜色的数量public static java.lang.String generalFormat(double number)
number
- 格式处理的数值对象public static double date2Int(java.util.Date date, int dayType)
date
- 和基准日期计算差距的日期对象dayType
- 计算差距的日期类型 (天数或年数等)public static java.util.Date long2Date(long number, int dateType)
number
- 要转为日期的long数值对象dateType
- 转化日期所参照的日期级别类型(年月日等)public static java.lang.Object getObject(int index, java.lang.Object[] objArray)
index
- 数组中取数的序号objArray
- 取数的数组对象public static java.awt.geom.RectangularShape rectangle2RoundRectangle(java.awt.geom.Rectangle2D bounds, boolean isTo)
bounds
- 要处理是否圆角的矩形对象isTo
- 是否转为圆角 true 表示转为圆角 false 表示不转public static java.awt.geom.RectangularShape rectangle2RoundRectangle(java.awt.geom.Rectangle2D bounds, double roundRadius)
bounds
- 要处理的矩形对象roundRadius
- 圆角大小public static JSONObject background2JS(Repository repo, Background background)
repo
- 请求background
- 进行js处理的对象backgroundpublic static void image2JS(Repository repo, JSONObject js, java.awt.Image image) throws JSONException
js
- 要添加图片js格式的JSONObject对象repo
- 请求image
- 要添加到js的图片JSONException
public static java.lang.String addImageAsEmb(java.awt.Image image)
image
- 被添加做内部资源的图片对象public static java.lang.String addImageAsEmb(java.awt.Image image, java.lang.String sessionID)
public static java.lang.String format2JS(java.text.Format format, Repository repo)
format
- 转化的格式对象repo
- 请求public static java.lang.String format2JS(java.text.Format format)
format
- 转化的格式对象public static java.awt.image.BufferedImage shapeToImage(java.awt.Shape shape, int strokeSize)
shape
- 转为图片的图形对象strokeSize
- shape边框大小public static java.lang.Object cloneObject(java.lang.Object object) throws java.lang.CloneNotSupportedException
object
- clone对象java.lang.CloneNotSupportedException
public static AttrFillStyle getServerFillStyle(AttrFillStyle fillStyle)