Exemplo n.º 1
0
		internal string GetBoxPlotSerieData(object o)
		{
			string str = "[";
			Boxplot boxplot = o as Boxplot;
			List<List<double>> list = boxplot.BoxPlotData as List<List<double>>;
			if (list == null)
			{
				throw new Exception("Boxplot Series has no BoxPlotData defined or the type of the data is not of the required type - List<List<double>>");
			}
			for (int i = 0; i < list.Count; i++)
			{
				List<double> list2 = list[i];
				str += "[";
				for (int j = 0; j < list2.Count; j++)
				{
					str += list2[j].ToString();
					if (j < list2.Count - 1)
					{
						str += ",";
					}
				}
				str += "]";
				if (i < list.Count - 1)
				{
					str += ",";
				}
			}
			str += "]";
			if (boxplot.Orientation == OrientType.Vertical)
			{
				str += ", {layout: 'vertical'}";
			}
			return str;
		}
Exemplo n.º 2
0
 public void SetUp()
 {
     _figure = new Figure()
     {
         Data = new DataPoints(x: _x, y: _y)
     };
     _scatter2D = new Scatter()
     {
         Data = new DataPoints(x: _x, y: _y)
     };
     _scatter3D = new Scatter()
     {
         Data = new DataPoints(x: _x, y: _y, z: _z)
     };
     _line2D = new Line()
     {
         Data = new DataPoints(x: _x, y: _y)
     };
     _filledCurves = new FilledCurves()
     {
         Data = new DataPoints(x: _x, y: _y, z: _z)
     };
     _linePoints2D = new LinePoints()
     {
         Data = new DataPoints(x: _x, y: _y)
     };
     _yError = new YError()
     {
         Data = new DataPoints(x: _x, y: _y, z: _z)
     };
     _line3D = new Line()
     {
         Data = new DataPoints(x: _x, y: _y, z: _z)
     };
     _linePoints3D = new LinePoints()
     {
         Data = new DataPoints(x: _x, y: _y, z: _z)
     };
     _impulse  = new Impulse();
     _function = new Function()
     {
         Properties = { Function = _f }
     };
     _bars = new Bars();
     Normal.Samples(_array, mean: 0, stddev: 1);
     _histogram = new Histogram()
     {
         Data = new DataPoints(x: _array)
     };
     _boxplot = new Boxplot()
     {
         Data = new DataPoints(x: _array)
     };
     _vector = new Vector()
     {
         Data = new DataPoints(x1: _x, x2: _y, y1: _z, y2: _z)
     };
 }
        private void ProcessBoxplot(StringBuilder sb)
        {
            List <object> list = default(List <object>);

            if (_chart.IsBoxPlot() && (list = (_chart.Series as List <object>)) != null)
            {
                foreach (object item in list)
                {
                    if (item is Boxplot)
                    {
                        Boxplot boxplot = item as Boxplot;
                        if (string.IsNullOrEmpty(boxplot.DataClientID))
                        {
                            throw new Exception("Must set DataClientID for Boxplot series.");
                        }
                        sb.Append($"var {boxplot.DataClientID} =  echarts.dataTool.prepareBoxplotData({_chart.GetBoxPlotSerieData(item)});");
                    }
                }
            }
        }