WPS 加载项开发 > 表格 API 参考 > Chart > 事件 > Chart.BeforeDoubleClick 事件
当双击某图表元素时发生此事件,此事件先于默认的双击操作。

语法

表达式.BeforeDoubleClick(ElementID, Arg1, Arg2, Cancel)

表达式   一个代表 Chart 对象的变量。

参数

名称 必选/可选 数据类型 说明
Cancel 必选 Boolean 事件发生时为 False。如果事件过程将此参数设为 True,则在完成此过程后,不执行默认的双击操作。
Arg1 必选 Long 其他事件信息,取决于 ElementID 的值。有关此参数的详细信息,请参阅“说明”部分。
Arg2 必选 Long 其他事件信息,取决于 ElementID 的值。有关此参数的详细信息,请参阅“说明”部分。
ElementID 必选 Long 双击的对象。此参数的值确定 Arg1 和 Arg2 的期望值。有关此参数的详细信息,请参阅“说明”部分。

说明

使用 DoubleClick 方法并不触发此事件。

用户双击单元格的边框时不触发此事件。

Arg1 和 Arg2 的含义取决于 ElementID 值,如下表中所示。

ElementID Arg1 Arg2
xlAxis AxisIndex AxisType
xlAxisTitle AxisIndex AxisType
xlDisplayUnitLabel AxisIndex AxisType
xlMajorGridlines AxisIndex AxisType
xlMinorGridlines AxisIndex AxisType
xlPivotChartDropZone DropZoneType 无
xlPivotChartFieldButton DropZoneType PivotFieldIndex
xlDownBars GroupIndex 无
xlDropLines GroupIndex 无
xlHiLoLines GroupIndex 无
xlRadarAxisLabels GroupIndex 无
xlSeriesLines GroupIndex 无
xlUpBars GroupIndex 无
xlChartArea 无 无
xlChartTitle 无 无
xlCorners 无 无
xlDataTable 无 无
xlFloor 无 无
xlLegend 无 无
xlNothing 无 无
xlPlotArea 无 无
xlWalls 无 无
xlDataLabel SeriesIndex PointIndex
xlErrorBars SeriesIndex 无
xlLegendEntry SeriesIndex 无
xlLegendKey SeriesIndex 无
xlSeries SeriesIndex PointIndex
xlTrendline SeriesIndex TrendLineIndex
xlXErrorBars SeriesIndex 无
xlYErrorBars SeriesIndex 无
xlShape ShapeIndex 无

下表对参数含义进行说明。

参数 说明
AxisIndex 指定坐标轴是主坐标轴还是次坐标轴。可为以下 XlAxisGroup 常量之一:xlPrimary 或 xlSecondary。
AxisType 指定坐标轴类型。可为以下 XlAxisType 常量之一:xlCategory、xlSeriesAxis 或 xlValue。
DropZoneType 指定拖放区的类型:列、数据、页或行字段。可为以下 XlPivotFieldOrientation 常量之一:xlColumnField、xlDataField、xlPageField 或 xlRowField。列和行字段常量分别指定了系列和分类字段。
GroupIndex 指定特定图表组在 ChartGroups 集合内的偏移量。
PivotFieldIndex 指定特定的列(系列)、数据、页或行(分类)字段在 PivotFields 集合中的偏移量。
PointIndex 指定某个系列中某一特定点在 Points 集合中的偏移量。值 -1 表示选择所有数据点。
SeriesIndex 指定特定系列在 Series 集合中的偏移量。
ShapeIndex 指定特定形状在 Shapes 集合中的偏移量。
TrendlineIndex 指定某个系列中特定趋势线在 Trendlines 集合中的偏移量。

示例

此示例将重写图表基底的默认双击操作。

示例代码
function Chart_BeforeDoubleClick(ElementID, Arg1, Arg2, Cancel) {
    if(ElementID == xlFloor) {
        Cancel = true
        MsgBox("Chart formatting for this item is restricted.")
	}
}


请参阅