当前位置: 首页>>代码示例>>C#>>正文


C# CurveItem.GetBarWidth方法代码示例

本文整理汇总了C#中ZedGraph.CurveItem.GetBarWidth方法的典型用法代码示例。如果您正苦于以下问题:C# CurveItem.GetBarWidth方法的具体用法?C# CurveItem.GetBarWidth怎么用?C# CurveItem.GetBarWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZedGraph.CurveItem的用法示例。


在下文中一共展示了CurveItem.GetBarWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawSingleBar

        /// <summary>
        /// Protected internal routine that draws the specified single bar (an individual "point")
        /// of this series to the specified <see cref="Graphics"/> device.
        /// </summary>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="GraphPane"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="curve">A <see cref="CurveItem"/> object representing the
        /// <see cref="Bar"/>'s to be drawn.</param>
        /// <param name="index">
        /// The zero-based index number for the single bar to be drawn.
        /// </param>
        /// <param name="pos">
        /// The ordinal position of the this bar series (0=first bar, 1=second bar, etc.)
        /// in the cluster of bars.
        /// </param>
        /// <param name="baseAxis">The <see cref="Axis"/> class instance that defines the base (independent)
        /// axis for the <see cref="Bar"/></param>
        /// <param name="valueAxis">The <see cref="Axis"/> class instance that defines the value (dependent)
        /// axis for the <see cref="Bar"/></param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="GraphPane.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        protected virtual void DrawSingleBar( Graphics g, GraphPane pane,
							CurveItem curve,
							int index, int pos, Axis baseAxis, Axis valueAxis,
							double scaleFactor )
        {
            // pixBase = pixel value for the bar center on the base axis
            // pixHiVal = pixel value for the bar top on the value axis
            // pixLowVal = pixel value for the bar bottom on the value axis
            float pixBase, pixHiVal, pixLowVal;

            float clusterWidth = pane.GetClusterWidth();
            float barWidth = curve.GetBarWidth( pane );
            float clusterGap = pane.MinClusterGap * barWidth;
            float barGap = barWidth * pane.MinBarGap;

            // curBase = the scale value on the base axis of the current bar
            // curHiVal = the scale value on the value axis of the current bar
            // curLowVal = the scale value of the bottom of the bar
            double curBase, curLowVal, curHiVal;
            BarValueHandler valueHandler = new BarValueHandler( pane );
            valueHandler.GetBarValues( curve, index, out curBase,
                    out curLowVal, out curHiVal );

            // Any value set to double max is invalid and should be skipped
            // This is used for calculated values that are out of range, divide
            //   by zero, etc.
            // Also, any value <= zero on a log scale is invalid

            if ( !curve.Points[index].IsInvalid )
            {
                // calculate a pixel value for the top of the bar on value axis
                pixLowVal = valueAxis.Transform( index, curLowVal );
                pixHiVal = valueAxis.Transform( index, curHiVal );
                // calculate a pixel value for the center of the bar on the base axis
                pixBase = baseAxis.Transform( index, curBase );

                // Calculate the pixel location for the side of the bar (on the base axis)
                float pixSide = pixBase - clusterWidth / 2.0F + clusterGap / 2.0F +
                                pos * ( barWidth + barGap );

                // Draw the bar
                if ( pane.BarBase == BarBase.X )
                    this.Draw( g, pane, pixSide, pixSide + barWidth, pixLowVal,
                                pixHiVal, scaleFactor, true );
                else
                    this.Draw( g, pane, pixLowVal, pixHiVal, pixSide, pixSide + barWidth,
                                scaleFactor, true );
               }
        }
开发者ID:InsungChoi,项目名称:dddd,代码行数:80,代码来源:Bar.cs


注:本文中的ZedGraph.CurveItem.GetBarWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。