Beispiel #1
0
        /// <summary>
        /// Create a URL for a <see cref="CurveItem" /> that includes the index of the
        /// point that was selected.
        /// </summary>
        /// <remarks>
        /// An "index" parameter is added to the <see cref="Url" /> property for this
        /// link to indicate which point was selected.  Further, if the 
        /// X or Y axes that correspond to this <see cref="CurveItem" /> are of
        /// <see cref="AxisType.Text" />, then an
        /// additional parameter will be added containing the text value that
        /// corresponds to the <paramref name="index" /> of the selected point.
        /// The <see cref="XAxis" /> text parameter will be labeled "xtext", and
        /// the <see cref="YAxis" /> text parameter will be labeled "ytext".
        /// </remarks>
        /// <param name="index">The zero-based index of the selected point</param>
        /// <param name="pane">The <see cref="GraphPane" /> of interest</param>
        /// <param name="curve">The <see cref="CurveItem" /> for which to
        /// make the url string.</param>
        /// <returns>A string containing the url with an index parameter added.</returns>
        public virtual string MakeCurveItemUrl( GraphPane pane, CurveItem curve, int index )
        {
            string url = _url;

            if ( url.IndexOf( '?' ) >= 0 )
                url += "&index=" + index.ToString();
            else
                url += "?index=" + index.ToString();

            Axis xAxis = curve.GetXAxis( pane );
            if (	xAxis.Type == AxisType.Text && index >= 0 &&
                    xAxis.Scale.TextLabels != null &&
                    index <= xAxis.Scale.TextLabels.Length )
                url += "&xtext=" + xAxis.Scale.TextLabels[index];

            Axis yAxis = curve.GetYAxis( pane );
            if (	yAxis != null && yAxis.Type == AxisType.Text && index >= 0 &&
                    yAxis.Scale.TextLabels != null &&
                    index <= yAxis.Scale.TextLabels.Length )
                url += "&ytext=" + yAxis.Scale.TextLabels[index];

            return url;
        }