コード例 #1
0
        /// <summary>
        /// Transforms an List of Entry into a float array containing the x and
        /// y values transformed with all matrices for the CANDLESTICKCHART.
        /// </summary>
        public SKPoint[] GenerateTransformedValuesLine(Interfaces.DataSets.ILineDataSet data,
                                                       float phaseX, float phaseY,
                                                       int min, int max)
        {
            Interfaces.DataSets.IDataSet dataSet = data;
            int count = ((int)((max - min) * phaseX) + 1);

            if (valuePointsForGenerateTransformedValuesLine.Length != count)
            {
                valuePointsForGenerateTransformedValuesLine = new SKPoint[count];
            }
            var valuePoints = valuePointsForGenerateTransformedValuesLine;

            for (int j = 0; j < count; j++)
            {
                var e = dataSet[j + min];

                if (e != null)
                {
                    valuePoints[j] = new SKPoint(e.X, e.Y * phaseY);
                }
            }

            return(ValueToPixelMatrix.MapPoints(valuePoints));
        }
コード例 #2
0
        protected override IList <Highlight> BuildHighlights(Interfaces.DataSets.IDataSet set, int dataSetIndex, float xVal, Data.DataSetRounding rounding)
        {
            //noinspection unchecked
            var entries = set.EntriesForXValue(xVal);

            if (entries.Count == 0)
            {
                // Try to find closest x-value and take all entries for that x-value
                Entry closest = set.EntryForXValue(xVal, float.NaN, rounding);
                if (closest != null)
                {
                    //noinspection unchecked
                    entries = set.EntriesForXValue(closest.X);
                }
            }

            int count = entries.Count;

            if (count == 0)
            {
                return(System.Array.Empty <Highlight>());
            }

            Highlight[] highlights = new Highlight[count];


            for (int i = 0; i < count; i++)
            {
                Entry e      = entries[i];
                var   pixels = Chart.GetTransformer(
                    set.AxisDependency).PointValueToPixel(e.Y, e.X);

                highlights[i] = new Highlight(
                    e.X, e.Y,
                    (float)pixels.X, (float)pixels.Y,
                    dataSetIndex, set.AxisDependency);
            }

            return(highlights);
        }
コード例 #3
0
 /// <summary>
 /// Applies the required styling (provided by the DataSet) to the value-paint
 /// object.
 /// </summary>
 protected void ApplyValueTextStyle(Interfaces.DataSets.IDataSet set)
 {
     ValuePaint.Typeface = set.ValueTypeface;
     ValuePaint.TextSize = set.ValueTextSize;
 }