33.28. <g:xAxis>

XAxis构件用于描绘X轴,它提供了大量属性,通过设置不同的属性值,可以得到各种不同的X轴,满足不同图表的显示要求。

33.28.1. 构件信息

表 33.77. 构件信息

Component Typeorg.operamasks.faces.graph.Axis
Component Familyorg.operamasks.faces.graph.Axis
Component Classorg.operamasks.faces.component.graph.UIAxis
Tag Classorg.operamasks.faces.webapp.graph.XAxisTag

继承体系

+java.lang.Object

++javax.faces.component.UIComponent

+++javax.faces.component.UIComponentBase

++++org.operamasks.faces.component.graph.UIAxis

33.28.2. 属性

表 33.78. 属性

baseLineColor 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Object)
是否必须 延时求值
指定基准线的颜色
binding 定义类 javax.faces.component.UIComponentBase
类型 javax.el.ValueExpression(javax.faces.component.UIComponent)
是否必须 延时求值
一个值表达式,用于把该组件链接到一个ManagedBean的某个属性。
drawBaseLine 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Boolean)
是否必须 延时求值
指定是否描绘基准线,默认值是false
drawGridLine 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Boolean)
是否必须 延时求值
指定是否绘制网格
drawLine 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(boolean)
是否必须 延时求值
指定是否描绘轴线,默认值是true
drawTickLabels 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(boolean)
是否必须 延时求值
指定是否显示轴标尺值,默认值是true
drawTickMarks 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(boolean)
是否必须 延时求值
指定是否显示轴标尺,默认值是true
gridLineColor 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Object)
是否必须 延时求值
指定网格的颜色
id 定义类 javax.faces.component.UIComponentBase
类型 java.lang.String
是否必须 延时求值
这个组件的组件标识符。这个值在最近的命名容器类型的父组件范围内,必须是唯一的。
inverted 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(boolean)
是否必须 延时求值
指定轴是否反向显示
itemTipFormat 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.String)
是否必须 延时求值
指定提示信息的格式
label 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.String)
是否必须 延时求值
指定构件的标题
labelAngle 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Double)
是否必须 延时求值
指定标题旋转角度
labelColor 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Object)
是否必须 延时求值
指定标题的字体颜色
labelFont 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Object)
是否必须 延时求值
指定标题的字体
lineColor 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Object)
是否必须 延时求值
指定轴的颜色
logarithmic 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(boolean)
是否必须 延时求值
指定构件是否变步长,默认值是false
lowerBound 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Object)
是否必须 延时求值
指定标尺的最小值
lowerMargin 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Double)
是否必须 延时求值
指定标尺小数值方向与图片边框的距离
mapTo 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.String)
是否必须 延时求值
指定构件的映射ID,属性值需为一个存在的UIChart构件id。当设置了这个值后,构件会映射另一个UIChart的Axis。此属性在构件包含于CompositeChart构件才有效
rendered 定义类 javax.faces.component.UIComponentBase
类型 boolean(boolean)
是否必须 延时求值
一个标志,指出该组件是否要在任何随后的form提交过程中被渲染或处理。 这个属性的缺省值是true。
tickLabelColor 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Object)
是否必须 延时求值
指定轴标尺值字体的颜色
tickLabelFont 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Object)
是否必须 延时求值
指定轴标尺值的字体
tickLabelFormat 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.String)
是否必须 延时求值
指定轴标尺值的格式
tickMarkColor 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Object)
是否必须 延时求值
指定轴标尺的颜色
tickMarkInsideLength 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Float)
是否必须 延时求值
指定轴标尺在数据图区内部的长度
tickMarkOutsideLength 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Float)
是否必须 延时求值
指定轴标尺在数据图区外部的长度
tickStep 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Double)
是否必须 延时求值
指定轴标尺的步长
tickUnit 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(org.operamasks.faces.component.graph.TimePeriodType)
是否必须 延时求值
指定轴的日期标签,只有使用g:timeSeries标签时有效
upperBound 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Object)
是否必须 延时求值
指定标尺的最大值
upperMargin 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(java.lang.Double)
是否必须 延时求值
指定标尺大数值方向与图片边框的距离
visible 定义类 org.operamasks.faces.component.graph.UIAxis
类型 javax.el.ValueExpression(boolean)
是否必须 延时求值
指定构件是否可见,默认值是true

33.28.3. 构件API

33.28.3.1. TimePeriodType(枚举类型)

表 33.79. 枚举成员

名称 说明
Year
Quarter
Month
Week星期
Day
Hour小时
Minute分钟
Second
Millisecond毫秒

33.28.4. 示例

以下的例子介绍了g:xAxis标签常用方法,在创建jsp页面之前,需要创建为数据表提供数据的托管Bean:

@ManagedBean(scope=ManagedBeanScope.REQUEST)
public class GraphData
{
    public double sine(double x) {
        return 2.0 * Math.sin(x);
    }

    public double cosine(double x) {
        return Math.cos(x);
    }

    public double tan(double x) {
        return Math.tan(x);
    }
}

下面是使用g:xAxis标签的代码。尽管XAxis的属性不少,但是常用的属性不多:

<g:xAxis drawBaseLine="true" logarithmic="true" label="X Axis"/> 
<g:yAxis drawBaseLine="true" label="Y Axis" labelAngle="-90"/> 
<g:lineChart> 
  <g:functionSeries> 
    <g:functionItem legend="y = cos(x)" start="1" end="10" step="0.1" expression="#{GraphData.cosine}" /> ]
    <g:functionItem legend="y = 2*sin(x)" start="1" end="10" step="0.1" expression="#{GraphData.sine}" /> 
  </g:functionSeries> 
</g:lineChart>