Пример #1
0
        /// <summary>
        /// Generates an array of DataDimensions that this DataPresenter provides.
        /// Since the provider only stores indices to the DataSet instead of actual references,
        /// this list needs to be generated by accessing the DataSet.
        /// </summary>
        /// <returns>The resulting array of DataDimensions.</returns>
        protected virtual DataDimension[] GetDimensionsArray()
        {
            var d = new DataDimension[_dataDimensionsIndices.Length];

            for (int i = 0; i < _dataDimensionsIndices.Length; i++)
            {
                d[i] = _dataProvider.Data[_dataDimensionsIndices[i]];
            }
            return(d);
        }
Пример #2
0
 /// <summary>
 /// Generates labels from the values of a single data dimension.
 /// The method will select automatically if the axis is numerical or categorical.
 /// If the label intervall was set to zero, all numerical axes will be threated as categorical.
 /// </summary>
 /// <param name="dataDim">The data dimension from which to generate the labels.</param>
 /// <param name="minItem">At which item index the axis should start. Detault is 0.</param>
 /// <param name="maxItem">At which item index the axis should end. A value of -1 means all of them. Default value is -1.</param>
 /// <returns>The generated list of axis ticks.</returns>
 public virtual AxisTick[] GenerateFromDimension(DataDimension dataDim, int minItem = 0, int maxItem = -1)
 {
     _labelTickIntervall = Mathf.Max(1, _labelTickIntervall);
     if (dataDim is INumericalDimension numDim && _tickIntervall > 0 && !_isCategorical)
     {
         // how many ticks can we fit between 0.0f and 1.0f given the tick intervall
         // if the calculation is converted directly to int in one command, there seem to be sometimes imprecision errors. Need to investigate further.
         float t         = 1.0f / _tickIntervall;
         int   tickCount = (int)t;
         return(GenerateNumerical(0, numDim.MaximumFloatValue, tickCount));
     }