Ejemplo n.º 1
0
        public static string TaskStringData()
        {
            var data = TaskArrayData();
            var cols = new JsonColumn[]
            {
                new JsonColumn {
                    label = "Task", type = "string"
                },
                new JsonColumn {
                    label = "Hours per Day", type = "number"
                }
            };

            var rows = new JsonRow[data.Count - 1];

            for (int i = 1; i < data.Count; i++)
            {
                var obj = data[i] as object[];
                rows[i - 1] = new JsonRow
                {
                    c = new JsonCell[] { new JsonCell {
                                             v = obj[0]
                                         }, new JsonCell {
                                             v = obj[1]
                                         } }
                };
            }
            return(JsonString.GetGoogleJson(cols, rows));
        }
Ejemplo n.º 2
0
        public static string MultilineStringData()
        {
            var data = MultilineArrayData();
            var cols = new JsonColumn[]
            {
                new JsonColumn {
                    label = "X", type = "number"
                },
                new JsonColumn {
                    label = "Sin(X)", type = "number"
                },
                new JsonColumn {
                    label = "Cos(X)", type = "number"
                },
                new JsonColumn {
                    label = "Sin(X)^2", type = "number"
                }
            };

            var rows = new JsonRow[data.Count - 1];

            for (int i = 1; i < data.Count; i++)
            {
                var obj = data[i] as object[];
                rows[i - 1] = new JsonRow
                {
                    c = new JsonCell[]
                    {
                        new JsonCell {
                            v = obj[0]
                        },
                        new JsonCell {
                            v = obj[1]
                        },
                        new JsonCell {
                            v = obj[2]
                        },
                        new JsonCell {
                            v = obj[3]
                        }
                    }
                };
            }
            return(JsonString.GetGoogleJson(cols, rows));
        }
Ejemplo n.º 3
0
        public static string IntervalStringData()
        {
            var d    = ModelHelper.IntervalArrayData();
            var cols = new JsonColumn[]
            {
                new JsonColumn {
                    label = "X", type = "number"
                },
                new JsonColumn {
                    label = "X*Sin(X*X)", type = "number"
                },
                new JsonColumn {
                    id = "i0", type = "number", role = "interval"
                },
                new JsonColumn {
                    id = "i0", type = "number", role = "interval"
                },
                new JsonColumn {
                    id = "i1", type = "number", role = "interval"
                },
                new JsonColumn {
                    id = "i1", type = "number", role = "interval"
                },
                new JsonColumn {
                    id = "i2", type = "number", role = "interval"
                },
                new JsonColumn {
                    id = "i2", type = "number", role = "interval"
                }
            };

            var rows = new JsonRow[d.Count - 1];

            for (int i = 1; i < d.Count; i++)
            {
                var obj = d[i] as object[];

                rows[i - 1] = new JsonRow
                {
                    c = new JsonCell[]
                    {
                        new JsonCell {
                            v = obj[0]
                        },
                        new JsonCell {
                            v = obj[1]
                        },
                        new JsonCell {
                            v = obj[2]
                        },
                        new JsonCell {
                            v = obj[3]
                        },
                        new JsonCell {
                            v = obj[4]
                        },
                        new JsonCell {
                            v = obj[5]
                        },
                        new JsonCell {
                            v = obj[6]
                        },
                        new JsonCell {
                            v = obj[7]
                        }
                    }
                };
            }
            return(JsonString.GetGoogleJson(cols, rows));
        }