`

Drawing a horizontal "target" line on a bar graph

 
阅读更多

1. 第二种方法:   put in Extension Points

 

Arg:plot_add

 

Value:

 

function() {
    var panel = new pv.Panel()
    .zOrder(999)
    .def('b0', function() {
        var ccc = this.getContext();
        var scale = ccc.chart.axes.ortho.scale;
        var li = ccc.panel._layoutInfo;
        return li.paddings.bottom + scale(y_value);
    });
    
    panel.add(pv.Rule)
    .strokeStyle('#3D80FF')
    .lineWidth(3)
    .left(0)
    .bottom(function() { return this.parent.b0(); })
    .width (function() { return this.parent.width(); })
    .height(null);
    
    return panel;
}

 

 

 

 

 

2. 第二种方法:   put in PreExecution

function f() {
    // Where to draw the horizontal line
    var y_value = 100;
    
    
    // Contains options that were specified in
    // the CDE properties tool window, already translated.
    var cccOptions = this.chartDefinition;

    // Beware that extension points require special treatment
    // (these are not yet translated to CCC options format)
    var eps = Dashboards.propertiesArrayToObject(cccOptions.extensionPoints);


    eps.plot_add = function() {
        var panel = new pv.Panel()
        .zOrder(999)
        .def('b0', function() {
            var ccc = this.getContext();
            var scale = ccc.chart.axes.ortho.scale;
            var li = ccc.panel._layoutInfo;
            return li.paddings.bottom + scale(y_value);
        });

        panel.add(pv.Rule)
        .strokeStyle('#3D80FF')
        .lineWidth(3)
        .left(0)
        .bottom(function() { return this.parent.b0(); })
        .width (function() { return this.parent.width(); })
        .height(null);

        return panel;
    };


    // Convert them to original CDE format:
    cccOptions.extensionPoints = Dashboards.objectToPropertiesArray(eps);
}

 

req

function f() {
    // Where to draw the horizontal line
    var y_value = 100;
    
    
    // Contains options that were specified in
    // the CDE properties tool window, already translated.
    var cccOptions = this.chartDefinition;

    // Beware that extension points require special treatment
    // (these are not yet translated to CCC options format)
    // var eps = Dashboards.propertiesArrayToObject(cccOptions.extensionPoints);


    add_line = ['plot_add', function() {
        var panel = new pv.Panel()
        .zOrder(999)
        .def('b0', function() {
            var ccc = this.getContext();
            var scale = ccc.chart.axes.ortho.scale;
            var li = ccc.panel._layoutInfo;
            return li.paddings.bottom + scale(y_value);
        });

        panel.add(pv.Rule)
        .strokeStyle('#3D80FF')
        .lineWidth(3)
        .left(0)
        .bottom(function() { return this.parent.b0(); })
        .width (function() { return this.parent.width(); })
        .height(null);

        return panel;
    }];
    
    cccOptions.extensionPoints.push(add_line);


    // Convert them to original CDE format:
    cccOptions.extensionPoints;
} 

 

 

这样就能添加一条水平线

...

分享到:
评论

相关推荐

    Drawing horizontal and vertical gridlines画水平和竖直的网格

    首先,创建一个canvas元素,然后获取其2D渲染上下文,通过context.beginPath、context.moveTo、context.lineTo和context.stroke来画线。还可以通过CSS样式来控制网格线的颜色和样式。 在移动应用开发中,如Android...

    Sii9022A 9024A.PDF

    horizontal line times and do not place a constraint on performance. (HDMI requires at least two line times in each vertical blanking interval.) The minimum horizontal blanking time depends on the ...

    Android代码-Direction-Line

    Can be used for a variety of uses, directions of a particular object at different times, addition to the graph, etc. []() Vertical and horizontal step line indicator. Setup Add it in your root ...

    曲线拟合工具CurveExpert 1.0

    + Drawing of data points on a graph is internally clipped if it is outside of the graphing window. This allows for faster graph drawing if many points are outside of the graph pane. + A separate ...

    Taking the pain out of adding a horizontal scrollbar to a li

    标题“Taking the pain out of adding a horizontal scrollbar to a listbox”指向的就是这样一个问题:如何优雅地为列表框添加水平滚动条,以提升用户体验。这里我们将详细探讨这个主题,并提供一些实践技巧。 ...

    Growth and Doping Modeling of SiC-CVD in a Horizontal (1).pdf

    《横向热壁反应器中SiC-CVD生长与掺杂模型》 硅碳化物(SiC)在后硅时代被视为一种有潜力的功率器件材料,因其宽的能隙和高的电击穿场强而备受青睐。SiC化学气相沉积(CVD)是制造器件的关键工艺之一。...

    A flow pattern map for gas—liquid flow in horizontal pipes

    本文旨在深入探讨水平管道中气液流动的流动模式及其特征,通过对《A flow pattern map for gas—liquid flow in horizontal pipes》(水平管中气液流动的流动模式图)这一主题的研究,揭示气液两相流行为的基本规律...

    matlab homework1

    matlab作业1题目 Introduction to MATLAB This homework is designed to teach you to think in terms of matrices and vectors because this is how MATLAB organizes data. You will find that complicated ...

    Horizontal_Tree

    【Horizontal Tree】是一种独特的树形布局方式,与传统的自顶向下垂直展示的树形图不同,它采用水平方向展示节点关系,形似家族谱。在数据可视化领域,这种布局方式常用于显示层次结构清晰且横向扩展较多的数据,...

    Scroll Bar MFC控件 使用范例

    4. **处理消息**:为了响应Scroll Bar的操作,如滑块移动,你需要在对话框类中处理SB_THUMBTRACK、SB_LINEUP、SB_LINEDOWN等消息。在消息映射(Message Map)中,添加如下代码: ``` BEGIN_MESSAGE_MAP(CMyDialog,...

    趣学Python编程 书中源代码

    Drawing a horizontal rectangle. horizonal_rectangle.py Drawing a vertical rectangle. horizonal_rectangle.py Drawing random rectangles. random_rectangles.py Drawing coloured rectangles. coloured_...

    BCGControlBarPro.v12.00

    The Ribbon bar Application ("main") Button can display a text label instead of icon in the "scenic" mode (usually "File" in English language UI). The following new methods were added to the ...

    Image_Graph Package入门.doc

    在这个示例中,我们使用了`Image_Graph::horizontal()`和`Image_Graph::vertical()`方法,构建了一个由四个部分组成的网格布局。这使得在同一个图像中展示不同数据集成为可能,例如,左上角和右下角各有一个条形图,...

    mobile-iPhone-Horizontal

    【标题】"mobile-iPhone-Horizontal" 指的是一个设计资源集合,专门针对iPhone设备的横向布局。在移动应用设计中,设备的横屏模式往往用于展示更宽广的内容或者提供不同的交互体验,比如游戏、地图应用或者多媒体...

    Dundas.Chart.for.Winform.Enterprise.v7.1.0.1812.for.VS2008

    Other New Features in V7.0 - Additional new features in V7.0 include Pair Bar Helper, Horizontal Box Plot Helper, Threshold Line Helper Add-on, Global Font Add-on, Stacked Pareto Helper and Circular ...

    wpf 状态栏 右下角三角statusbar

    在Windows Presentation Foundation(WPF)中,状态栏(StatusBar)是一种常见的用户界面元素,用于显示应用程序的状态信息或者提示用户的相关消息。"右下角三角"通常指的是在状态栏中添加了一个可以折叠或展开的...

    pageflow-horizontal-navigation-bar:沿着顶部对齐的Pageflow导航栏小部件

    config.widget_types.register(Pageflow::HorizontalNavigationBar.widget_type) end 包括javascript和样式表: # app/assets/javascripts/pageflow/application.js //= require pageflow/horizontal_navigation_...

    VHD.rar_line detection

    this code is for vertical horizontal line detection.

    bar-horizontal:创建适合您终端的漂亮水平图表

    $ npm install --save bar-horizontal 用法 var barHorizontal = require ( 'bar-horizontal' ) ; barHorizontal ( [ 6 , 5 , 4 , 3 , 2 ] ) ; // => Prints this on the console :- : ▇▇▇▇▇▇▇▇▇▇▇▇▇...

Global site tag (gtag.js) - Google Analytics