Beispiel #1
0
        public NChartPoint[] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            List <NChartPoint> result = new List <NChartPoint> ();


            NChartPointState state = NChartPointState.PointStateWithXYZ(
                random.Next(10) + 1,
                random.Next(10) + 1,
                random.Next(10) + 1);

            state.Marker       = new NChartMarker();
            state.Marker.Size  = (float)random.Next(30) + 1.0f;
            state.Marker.Brush = brushes [series.Tag];
            if (!DrawIn3D)
            {
                state.Marker.Shape = NChartMarkerShape.Circle;
                state.Marker.Brush.ShadingModel = NChartShadingModel.Plain;
                state.Marker.Brush.Opacity      = 0.8f;
            }
            else
            {
                state.Marker.Shape = NChartMarkerShape.Sphere;
                state.Marker.Brush.ShadingModel = NChartShadingModel.Phong;
            }
            result.Add(new NChartPoint(state, series));

            return(result.Count > 0 ? result.ToArray() : null);
        }
        public NChartPoint[] Points(NChartSeries series)
        {
            // Create points for series as seen on the picture. A bit wired logic: we double the points in the middle of
            // line to have individual segments. This will help us to achieve the effect of floating color. Also we calculate
            // the length of the line.
            FloatingColorViewController.m_length = 0.0;
            List <NChartPoint> result = new List <NChartPoint>();

            for (int i = 1, n = 11; i < n; ++i)
            {
                int value = (m_rand.Next() % 30) + 1;
                NChartPointState state = NChartPointState.PointStateAlignedToXWithXY(i, value);
                // Let the line have markers in the points.
                state.Marker       = new NChartMarker();
                state.Marker.Shape = NChartMarkerShape.Circle;
                if (i > 1)
                {
                    NChartPointState prevState = result[result.Count - 1].CurrentState;
                    FloatingColorViewController.m_length += FloatingColorViewController.hypot(state.DoubleX - prevState.DoubleX, state.DoubleY - prevState.DoubleY);
                }
                result.Add(new NChartPoint(state, series));
                if (i > 1 && i < n - 1)
                {
                    NChartPointState addlState = NChartPointState.PointStateAlignedToXWithXY(i, value);
                    addlState.Marker       = new NChartMarker();
                    addlState.Marker.Shape = NChartMarkerShape.Circle;
                    result.Add(new NChartPoint(addlState, series));
                }
            }

            return(result.ToArray());
        }
 public NChartPoint [] Points(NChartSeries series)
 {
     // Create points with some data for the series.
     NChartPoint[] result = new NChartPoint[3];
     for (int i = 0; i < 3; ++i)
     {
         NChartPointState[] states = new NChartPointState[3];
         for (int j = 0; j < 3; ++j)
         {
             NChartPointState state = NChartPointState.PointStateWithXYZ(
                 (m_rand.Next() % 10) + 1,
                 (m_rand.Next() % 10) + 1,
                 (m_rand.Next() % 10) + 1
                 );
             state.Marker       = new NChartMarker();
             state.Marker.Size  = (float)(m_rand.Next() % 1000) / 1000.0f;
             state.Marker.Brush = brushes[series.Tag];
             state.Marker.Shape = NChartMarkerShape.Sphere;
             state.Marker.Brush.ShadingModel = NChartShadingModel.Phong;
             states[j] = state;
         }
         result[i] = new NChartPoint(states, series);
     }
     return(result);
 }
Beispiel #4
0
        public NChartPoint[] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            List <NChartPoint> result = new List <NChartPoint> ();


            if (DrawIn3D)
            {
                for (int i = 0; i <= 4; ++i)
                {
                    for (int j = 0; j <= 4; ++j)
                    {
                        result.Add(new NChartPoint(NChartPointState.PointStateAlignedToYZWithXYZ(random.Next(30) + 1, i, j), series));
                    }
                }
            }
            else
            {
                for (int i = 0; i <= 10; ++i)
                {
                    result.Add(new NChartPoint(NChartPointState.PointStateAlignedToYWithXY(random.Next(30) + 1, i), series));
                }
            }

            return(result.Count > 0 ? result.ToArray() : null);
        }
Beispiel #5
0
        public NChartPoint [] ExtraPoints(NChartSeries series)
        {
            NChartPointState result = randomState(m_count);

            ++m_count;
            return(new NChartPoint[] { new NChartPoint(result, series) });
        }
        public NChartPoint[] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            List <NChartPoint> result = new List <NChartPoint>();

            if (drawIn3D)
            {
                for (int i = 0; i <= 4; ++i)
                {
                    for (int j = 0; j <= 4; ++j)
                    {
                        result.Add(new NChartPoint(NChartPointState.PointStateAlignedToXZWithXYZ(i, (m_rand.Next() % 30) + 1, j), series));
                    }
                }
            }
            else
            {
                for (int i = 0; i <= 10; ++i)
                {
                    result.Add(new NChartPoint(NChartPointState.PointStateAlignedToXWithXY(i, (m_rand.Next() % 30) + 1), series));
                }
            }

            return(result.ToArray());
        }
Beispiel #7
0
 public NChartPoint[] Points(NChartSeries series)
 {
     // Create points with some data for the series.
     NChartPoint[] result = new NChartPoint[1];
     result[0] = new NChartPoint(NChartPointState.PointStateWithCircleValue(0, random.Next(30) + 1), series);
     return(result);
 }
Beispiel #8
0
 public NChartPoint[] Points(NChartSeries series)
 {
     // Create points with some data for the series.
     NChartPoint[] result = new NChartPoint[1];
     result[0]         = new NChartPoint(NChartPointState.PointStateWithCircleValue(0, random.Next() % 30 + 1), series);
     result[0].Tooltip = CreateCallout(string.Format("Callout for series {0}", series.Tag + 1), series.Tag);
     return(result);
 }
        public NChartPoint[] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            List <NChartPoint> result = new List <NChartPoint>();

            result.Add(new NChartPoint(NChartPointState.PointStateWithCircleValue(0, random.Next(30) + 1), series));

            return(result.Count > 0 ? result.ToArray() : null);
        }
Beispiel #10
0
        NChartPointState randomState(int index)
        {
            double low   = 20.0 - myrand(5);
            double high  = 22.0 + myrand(5);
            double open  = low + myrand((int)(high - low));
            double close = low + myrand((int)(high - low));

            return(NChartPointState.PointStateAlignedToXWithXLowOpenCloseHigh(index, low, open, close, high));
        }
Beispiel #11
0
 public NChartPoint[] Points(NChartSeries series)
 {
     NChartPoint[] result = new NChartPoint[11];
     for (int i = 0; i <= 10; ++i)
     {
         result[i] = new NChartPoint(NChartPointState.PointStateAlignedToXWithXY(i, random.Next(30) + 1), series);
     }
     return(result);
 }
Beispiel #12
0
 public NChartPoint[] Points(NChartSeries series)
 {
     NChartPoint[] result = new NChartPoint[10];
     for (int i = 0; i < 10; ++i)
     {
         int y = (random.Next(26) + 1) * (series.Tag == 2 ? 2 : 1);
         result [i] = new NChartPoint(NChartPointState.PointStateAlignedToXWithXY(i, y), series);
     }
     return(result);
 }
        public NChartPoint[] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            List <NChartPoint> result = new List <NChartPoint>();

            for (int i = 0; i <= 10; ++i)
            {
                result.Add(new NChartPoint(NChartPointState.PointStateAlignedToXWithXY(i, m_rand.Next() % 30 + 1), series));
            }
            return(result.ToArray());
        }
        public NChartPoint[] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            List <NChartPoint> result = new List <NChartPoint>();

            for (int i = 0; i <= 10; ++i)
            {
                result.Add(new NChartPoint(NChartPointState.PointStateAlignedToXZWithXYZ(i, random.Next(30) + 1, series.Tag), series));
            }

            return(result.Count > 0 ? result.ToArray() : null);
        }
Beispiel #15
0
        public NChartPoint[] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            List <NChartPoint> result = new List <NChartPoint> ();

            for (int i = 0; i < 10; ++i)
            {
                double low  = random.Next(20);
                double high = random.Next(20);
                result.Add(new NChartPoint(NChartPointState.PointStateAlignedToXWithXLowHigh(i, low, high), series));
            }

            return(result.Count > 0 ? result.ToArray() : null);
        }
        public NChartPoint[] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            List <NChartPoint> result = new List <NChartPoint> ();

            for (int i = 0; i < 30; ++i)
            {
                int    y     = random.Next(4);
                double open  = random.Next(30);
                double close = open + 1.0;
                result.Add(new NChartPoint(NChartPointState.PointStateAlignedToYWithYOpenClose(y, open, close), series));
            }

            return(result.Count > 0 ? result.ToArray() : null);
        }
Beispiel #17
0
 public NChartPoint[] Points(NChartSeries series)
 {
     // Create points with some data for the series.
     NChartPoint[] result = new NChartPoint[10];
     for (int i = 0; i < 10; ++i)
     {
         NChartPointState[] states = new NChartPointState[3];
         for (int j = 0; j < 3; ++j)
         {
             states[j] = NChartPointState.PointStateWithXYZ(i, random.Next(30) + 1, 0);
         }
         result[i] = new NChartPoint(states, series);
     }
     return(result);
 }
Beispiel #18
0
        public NChartPoint[] Points(NChartSeries series)
        {
            List <NChartPoint> result = new List <NChartPoint>();

            for (int i = 0, n = 20; i < n; ++i)
            {
                for (int j = 0, m = 20; j < m; ++j)
                {
                    double           x     = (double)(i) * 2.0 * System.Math.PI / (double)n;
                    double           z     = (double)(j) * 2.0 * System.Math.PI / (double)m;
                    double           y     = System.Math.Sin(x) * System.Math.Cos(z);
                    NChartPointState state = NChartPointState.PointStateWithXYZ(x, y, z);
                    result.Add(new NChartPoint(state, series));
                }
            }
            return(result.ToArray());
        }
Beispiel #19
0
        public NChartPoint[] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            List <NChartPoint> result = new List <NChartPoint>();

            for (int i = 0, n = 75; i <= n; ++i)
            {
                for (int j = 0, m = 75; j <= m; ++j)
                {
                    double x     = 1.0 - 2.0 * (double)(i) / (double)(n);
                    double y     = 1.0 - 2.0 * (double)(j) / (double)(m);
                    double value = (1.0 - System.Math.Abs(x * y)) * System.Math.Sin((1.0 - System.Math.Abs(x * y)) * System.Math.PI * 4.0);
                    result.Add(new NChartPoint(NChartPointState.PointStateWithXYValue(x, y, value), series));
                }
            }

            return(result.Count > 0 ? result.ToArray() : null);
        }
Beispiel #20
0
        public NChartPoint [] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            List <NChartPoint> result = new List <NChartPoint> ();

            for (int i = 0; i < 30; ++i)
            {
                double open  = 5.0f * Math.Sin((float)i * Math.PI / 10);
                double close = 5.0f * Math.Cos((float)i * Math.PI / 10);
                double low   = Math.Min(open, close) - (m_rand.Next() % 3);
                double high  = Math.Max(open, close) + (m_rand.Next() % 3);
                result.Add(new NChartPoint(NChartPointState.PointStateAlignedToXZWithXZLowOpenCloseHigh(
                                               i, series.Tag, low, open, close, high
                                               ), series));
            }

            return(result.ToArray());
        }
        public NChartPoint[] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            List <NChartPoint> result = new List <NChartPoint>();

            for (int i = 0, n = 20; i < n; ++i)
            {
                for (int j = 0, m = 20; j < m; ++j)
                {
                    double x = (double)(i) * 2.0 * System.Math.PI / (double)n;
                    double z = (double)(j) * 2.0 * System.Math.PI / (double)m;
                    double y = System.Math.Sin(x) * System.Math.Cos(z);

                    NChartPointState state = NChartPointState.PointStateWithXYZ(i, y, j);
                    result.Add(new NChartPoint(state, series));
                }
            }

            return(result.Count > 0 ? result.ToArray() : null);
        }
        public NChartPoint [] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            List <NChartPoint> result     = new List <NChartPoint> ();
            int              numberOfDays = 8;
            int              startDay     = 2;
            NSCalendar       cal          = NSCalendar.CurrentCalendar;
            NSDateComponents comp         = new NSDateComponents();

            comp.Year  = 2015;
            comp.Month = 1;
            comp.Day   = 2;
            NSDate startDate = cal.DateFromComponents(comp);

            for (int i = 0; i < numberOfDays; ++i)
            {
                NSDate date = cal.DateBySettingUnit(NSCalendarUnit.Day, startDay + i, startDate, NSCalendarOptions.None);
                result.Add(new NChartPoint(NChartPointState.PointStateAlignedToXWithXY(date, m_rand.Next() % 30 + 1), series));
            }

            return(result.ToArray());
        }
        public NChartPoint [] Points(NChartSeries series)
        {
            // Create points with some data for the series.
            NChartPointState state = NChartPointState.PointStateWithXYZ((m_rand.Next() % 10) + 1, (m_rand.Next() % 10) + 1, (m_rand.Next() % 10) + 1);

            state.Marker       = new NChartMarker();
            state.Marker.Size  = (m_rand.Next() % 30) + 1;
            state.Marker.Brush = brushes [series.Tag];
            if (!drawIn3D)
            {
                state.Marker.Shape = NChartMarkerShape.Circle;
                state.Marker.Brush.ShadingModel = NChartShadingModel.Plain;
                state.Marker.Brush.Opacity      = 0.8f;
            }
            else
            {
                state.Marker.Shape = NChartMarkerShape.Sphere;
                state.Marker.Brush.ShadingModel = NChartShadingModel.Phong;
            }

            return(new NChartPoint[] { new NChartPoint(state, series) });
        }
Beispiel #24
0
        public NChartPoint[] Points(NChartSeries series)
        {
            // Create chart points with dates by X-Axis.
            const int numberOfDays = 8;
            const int startDay     = 2;

            NChartPoint[] result = new NChartPoint[numberOfDays];
            Calendar      cal    = Calendar.Instance;

            cal.Set(CalendarField.Year, 2015);
            cal.Set(CalendarField.Month, 1);
            cal.Set(CalendarField.DayOfMonth, startDay);
            cal.Set(CalendarField.HourOfDay, 12);
            Date startDate = cal.Time;

            for (int i = 0; i < numberOfDays; ++i)
            {
                cal.Set(CalendarField.DayOfMonth, startDay + i);
                Date date = cal.Time;
                result[i] = new NChartPoint(NChartPointState.PointStateAlignedToXWithXY(date, random.Next(30) + 1), series);
            }
            return(result);
        }
 public NChartPoint [] Points(NChartSeries series)
 {
     // Create points with some data for the series.
     return(new NChartPoint[] { new NChartPoint(NChartPointState.PointStateWithCircleValue(0, (m_rand.Next() % 30) + 1), series) });
 }
        void ChangeColor(object series)
        {
            // Update chart data to display process.

            // Timer create another thread, need use begin-end transaction functions.
            m_view.Chart.BeginTransaction();

            NChartPoint[] points = (series as NChartSeries).Points();

            if (m_t >= 1.0f)
            {
                m_timer.Change(Timeout.Infinite, Timeout.Infinite);

                // Color all the points.
                foreach (NChartPoint point in points)
                {
                    point.CurrentState.Brush        = new NChartSolidColorBrush(UIColor.Red);
                    point.CurrentState.Marker.Brush = new NChartSolidColorBrush(UIColor.Red);
                }

                // Update data in the chart. For that we usr lightweight method that does not relaod data from data source,
                // because we just updated some info in the existing points.
                m_view.Chart.UpdateSeries();

                // Exit.
                m_view.Chart.EndTransaction();
                return;
            }

            // The idea of displaying process is to change colors of i-th and (i+1)-th chart points for each m_t and
            // therefore to make the color "float" through the segment.

            // Firsly find out the points according to current m_t.
            NChartPointState s1 = null, s2 = null;
            double           s = m_t * m_length;
            double           curLen = 0.0, prevLen = 0.0;
            int i, n;

            for (i = 0, n = points.Length - 1; i < n; ++i)
            {
                s1      = points[i].CurrentState;
                s2      = points[i + 1].CurrentState;
                prevLen = curLen;
                curLen += hypot(s2.DoubleX - s1.DoubleX, s2.DoubleY - s1.DoubleY);
                if (prevLen <= s && curLen >= s)
                {
                    break;
                }
            }

            // Secondly determine the color for the points to display the process. The color over the line is calculated
            // automatically through the linear interpolation.
            float  R = 0.38f;
            float  G = 0.8f;
            float  B = 0.91f;
            double c = curLen - prevLen;

            if (c > 0.0)
            {
                c = (s - prevLen) / c;
            }
            else
            {
                c = 1.0;
            }
            if (c < 0.5)
            {
                c       *= 2.0;
                s1.Brush = new NChartSolidColorBrush(UIColor.FromRGB((float)(c + (1.0f - c) * R), (float)((1.0f - c) * G), (float)((1.0f - c) * B)));
            }
            else
            {
                c               = (c - 0.5) * 2.0;
                s1.Brush        = new NChartSolidColorBrush(UIColor.Red);
                s1.Marker.Brush = new NChartSolidColorBrush(UIColor.Red);
                s2.Brush        = new NChartSolidColorBrush(UIColor.FromRGB((float)(c + (1.0f - c) * R), (float)((1.0f - c) * G), (float)((1.0f - c) * B)));
                s2.Marker.Brush = new NChartSolidColorBrush(UIColor.FromRGB((float)(c + (1.0f - c) * R), (float)((1.0f - c) * G), (float)((1.0f - c) * B)));
            }

            // All the previous points should be colored.
            for (int j = 0; j < i; ++j)
            {
                points[j].CurrentState.Brush        = new NChartSolidColorBrush(UIColor.Red);
                points[j].CurrentState.Marker.Brush = new NChartSolidColorBrush(UIColor.Red);
            }

            // Update data in the chart. For that we usr lightweight method that does not relaod data from data source,
            // because we just updated some info in the existing points.
            m_view.Chart.UpdateSeries();

            // Update the virtual process we display.
            m_t += 1.0 / 30.0 / 5.0;

            m_view.Chart.EndTransaction();
        }
		public NChartPoint [] SeriesDataSourcePointsForSeries (NChartSeries series)
		{
			// Create points with some data for the series.
			NChartPoint[] result = new NChartPoint[3];
			for (int i = 0; i < 3; ++i)
			{
				NChartPointState[] states = new NChartPointState[3];
				for (int j = 0; j < 3; ++j)
				{
					NChartPointState state = NChartPointState.PointStateWithXYZ (
						(m_rand.Next () % 10) + 1, 
						(m_rand.Next () % 10) + 1, 
						(m_rand.Next () % 10) + 1
					);
					state.Marker = new NChartMarker ();
					state.Marker.Size = (float)(m_rand.Next() % 1000) / 1000.0f;
					state.Marker.Brush = brushes[series.Tag];
					state.Marker.Shape = NChartMarkerShape.Sphere;
					state.Marker.Brush.ShadingModel = NChartShadingModel.Phong;
					states[j] = state;
				}
				result[i] = NChartPoint.PointWithArrayOfStates (states, series);
			}
			return result;
		}
		public NChartPoint[] PointsForSeries (NChartSeries series)
		{
			// Create points with some data for the series.
			NChartPoint[] result = new NChartPoint[3];
			for (int i = 0; i < 3; ++i) {
				NChartPointState[] states = new NChartPointState[3];
				for (int j = 0; j < 3; ++j) {
					NChartPointState state = NChartPointState.PointStateWithXYZ (
						random.Next (10) + 1, 
						random.Next (10) + 1, 
						random.Next (10) + 1);
					state.Marker = new NChartMarker ();
					state.Marker.Size = (float)random.NextDouble ();
					state.Marker.Brush = brushes [series.Tag];
					state.Marker.Shape = NChartTypes.MarkerShape.Sphere;
					state.Marker.Brush.ShadingModel = NChartTypes.ShadingModel.Phong;

					states [j] = state;
				}
				result [i] = new NChartPoint (states, series);
			}
			return result;
		}
Beispiel #29
0
 public NChartPoint[] Points(NChartSeries series)
 {
     // Create points with some data for the series.
     return(new NChartPoint[] { new NChartPoint(NChartPointState.PointStateWithXYZ(0, m_rand.Next() % 30, 0), series) });
 }