Beispiel #1
0
        private static AxisOptions getAxisOptions()
        {
            var axisOptions = new AxisOptions(NoConverter.Instance)
            {
                Title                = "Test Title",
                YLabel               = "Y Axis with = sign",
                IsUsedForBoxPlots    = true,
                BoxPlotDrawDirection = AxisOptions.BoxPlotDrawDirections.y,
                YMode                = AxisOptions.AxisMode.normal,
                XTicks               = new[] { 1F, 2F },
                XTickLabels          = new[] { "Group A, with special character", "Group B" },
                XAxisPosition        = AxisOptions.AxisXLine.bottom,
                YAxisPosition        = AxisOptions.AxisYLine.left,
                YMajorGrid           = true,
                YAxisArrow           = true,
                EnlargeLimits        = true,
                LegendOptions        = new LegendOptions {
                    Columns = 2, LegendPosition = LegendOptions.LegendPositions.South
                }
            };

            axisOptions.GroupLines.Add(new AxisOptions.GroupLine(1F, 2F, "All", 1));
            axisOptions.GroupLines.Add(new AxisOptions.GroupLine(1F, 2F, "Total", 2));

            return(axisOptions);
        }
Beispiel #2
0
        private AxisOptions getAxisOptions(DistributionSettings settings, ContinuousDistributionData data)
        {
            var axisOptions = new AxisOptions(DefaultConverter.Instance)
            {
                XLabel        = settings.XAxisTitle,
                YLabel        = settings.YAxisTitle,
                Title         = settings.PlotCaption,
                EnlargeLimits = false,
                YMin          = 0,
                YMajorGrid    = true,
                LegendOptions = new LegendOptions {
                    LegendPosition = LegendOptions.LegendPositions.NorthEast
                }
            };

            if (isSingleValueDistribution(data))
            {
                var value = getSingleValueDistributionValue(data);
                if (!float.IsNaN(value))
                {
                    axisOptions.XMin   = value - (float)data.BarWidth;
                    axisOptions.XMax   = value + (float)data.BarWidth;
                    axisOptions.XTicks = new [] { value };
                }
            }

            return(axisOptions);
        }
    private float SnapFloat(float value, AxisOptions snapAxis)
    {
        if (value == 0)
            return value;

        if (axisOptions == AxisOptions.Both)
        {
            float angle = Vector2.Angle(input, Vector2.up);
            if (snapAxis == AxisOptions.Horizontal)
            {
                if (angle < 22.5f || angle > 157.5f)
                    return 0;
                else
                    return (value > 0) ? 1 : -1;
            }
            else if (snapAxis == AxisOptions.Vertical)
            {
                if (angle > 67.5f && angle < 112.5f)
                    return 0;
                else
                    return (value > 0) ? 1 : -1;
            }
            return value;
        }
        else
        {
            if (value > 0)
                return 1;
            if (value < 0)
                return -1;
        }
        return 0;
    }
        private static AxisOptions getAxisOptionsForGroup(float[] xTicks, string[] xTickLabels)
        {
            var axisOptions = new AxisOptions(DefaultConverter.Instance)
            {
                IsUsedForBoxPlots    = true,
                BoxPlotDrawDirection = AxisOptions.BoxPlotDrawDirections.y,
                YMode         = AxisOptions.AxisMode.normal,
                XMin          = -0.5F,
                XMax          = xTickLabels.Count() - 0.5F,
                XTicks        = xTicks,
                XTickLabels   = xTickLabels,
                XAxisPosition = AxisOptions.AxisXLine.bottom,
                YAxisPosition = AxisOptions.AxisYLine.left,
                YMajorGrid    = true,
                YAxisArrow    = true,
                EnlargeLimits = true
            };

            if (xTickLabels.Sum(x => x.Length) >= 40)
            {
                axisOptions.XTickLabelsRotateBy  = 45;
                axisOptions.XGroupLineTextOffset = Helper.Length(xTickLabels.Max(t => t.Length) * 0.7, Helper.MeasurementUnits.ex);
            }

            return(axisOptions);
        }
        private static AxisOptions getAxisOptions(LegendOptions.LegendPositions legendPosition)
        {
            var axisOptions = new AxisOptions(NoConverter.Instance)
            {
                Title         = "Test Title",
                YLabel        = "Y Axis",
                YMode         = AxisOptions.AxisMode.normal,
                YMin          = 0F,
                XMin          = 0F,
                XMax          = 4F,
                XTicks        = new[] { 1F, 2F, 3F },
                XTickLabels   = new[] { "Group A", "Group B", "Group C" },
                XAxisPosition = AxisOptions.AxisXLine.bottom,
                YAxisPosition = AxisOptions.AxisYLine.left,
                YMajorGrid    = true,
                YAxisArrow    = true,
                EnlargeLimits = false,
                LegendOptions = new LegendOptions {
                    Columns = 1, LegendPosition = legendPosition
                }
            };

            axisOptions.GroupLines.Add(new AxisOptions.GroupLine(1F, 2F, "A-B", 1));

            return(axisOptions);
        }
Beispiel #6
0
 public Plot(IEnumerable <Color> colors, AxisOptions axisOptions, IEnumerable <TeX.PGFPlots.Plot> plots, Text caption) :
     base(axisOptions, plots)
 {
     Colors    = colors;
     Position  = FigureWriter.FigurePositions.htbp;
     Caption   = caption;
     Label     = Helper.Marker();
     Landscape = false;
 }
Beispiel #7
0
        private static AxisOptions getAxisOptionsForPlot()
        {
            var plotAxisOptionsWithoutGroupLines = new AxisOptions(NoConverter.Instance)
            {
                Title = "Test Title using = and ,."
            };

            return(plotAxisOptionsWithoutGroupLines);
        }
Beispiel #8
0
 private static void adjustAxisDimensionForFigures(AxisOptions axisOptions, bool landscape, bool isLegendBeside, int percentageLandscape, int percentageLegendBeside, int percentageNoLegendBeside = 100)
 {
     if (landscape)
     {
         axisOptions.Height = Helper.GetLengthInPercentageOfTextWidth(percentageLandscape);
     }
     else
     {
         axisOptions.Width = Helper.GetLengthInPercentageOfTextWidth(isLegendBeside ? percentageLegendBeside : percentageNoLegendBeside);
     }
 }
Beispiel #9
0
    private float SnapFloat(float value, AxisOptions snapAxis)
    {
        if (value == 0)
        {
            return(value);
        }

        if (axisOptions == AxisOptions.Both)
        {
            float angle = Vector2.Angle(input, Vector2.up);
            if (snapAxis == AxisOptions.Horizontal)
            {
                if (angle < 22.5f || angle > 157.5f)
                {
                    return(0);
                }
                else
                {
                    return((value > 0) ? 1 : -1);
                }
            }
            else if (snapAxis == AxisOptions.Vertical)
            {
                if (angle > 67.5f && angle < 112.5f)
                {
                    return(0);
                }
                else
                {
                    return((value > 0) ? 1 : -1);
                }
            }

            return(value);
        }
        else
        {
            if (value > 0)
            {
                return(1);
            }
            if (value < 0)
            {
                return(-1);
            }
        }

        return(0);
    }
        private AxisOptions getAxisOptions(CurveChart chart, AxisTypes yAxisType)
        {
            var legendOptions = new LegendOptions
            {
                LegendPosition  = getLegendPosition(chart.ChartSettings.LegendPosition),
                LegendAlignment = LegendOptions.LegendAlignments.left,
                FontSize        = LegendOptions.FontSizes.scriptsize,
                RoundedCorners  = false
            };

            var axisOptions = new AxisOptions(DefaultConverter.Instance)
            {
                LegendOptions   = legendOptions,
                Title           = chart.Title,
                BackgroundColor = chart.ChartSettings.DiagramBackColor.Name,
                EnlargeLimits   = chart.ChartSettings.SideMarginsEnabled
            };

            foreach (var axis in chart.Axes)
            {
                if (axis.AxisType == AxisTypes.X)
                {
                    axisOptions.XLabel = getAxisLabel(axis);
                    axisOptions.XMax   = axis.Max;
                    axisOptions.XMin   = axis.Min;
                    var unit = axis.Dimension.Unit(axis.UnitName);

                    axisOptions.XMajorGrid = axis.GridLines;
                    axisOptions.XMode      = getAxisMode(axis.Scaling);

                    axisOptions.XAxisPosition = AxisOptions.AxisXLine.box;
                    axisOptions.XAxisArrow    = false;
                }
                else if (axis.AxisType == yAxisType)
                {
                    axisOptions.YLabel = getAxisLabel(axis);
                    axisOptions.YMax   = axis.Max;
                    axisOptions.YMin   = axis.Min;

                    axisOptions.YMajorGrid = axis.GridLines;
                    axisOptions.YMode      = getAxisMode(axis.Scaling);

                    axisOptions.YAxisPosition = AxisOptions.AxisYLine.left;
                    axisOptions.YAxisArrow    = false;
                }
            }

            return(axisOptions);
        }
        protected static AxisOptions GetAxisOptionsForGroup(string xlabel)
        {
            var axisOptions = new AxisOptions(DefaultConverter.Instance)
            {
                YMode         = AxisOptions.AxisMode.normal,
                XLabel        = xlabel,
                XAxisPosition = AxisOptions.AxisXLine.bottom,
                YAxisPosition = AxisOptions.AxisYLine.left,
                YMajorGrid    = true,
                YAxisArrow    = true,
                EnlargeLimits = true
            };

            return(axisOptions);
        }
Beispiel #12
0
 public GroupPlot(IEnumerable <Color> colors, AxisOptions axisOptions, GroupOptions groupOptions, IEnumerable <IBasePlot> groupedPlots, Text caption)
 {
     Colors       = colors;
     AxisOptions  = axisOptions;
     GroupOptions = groupOptions;
     if (GroupOptions.GroupLegendOptions != null && groupOptions.GroupLegendOptions.LegendOptions != null)
     {
         axisOptions.LegendOptions = null;
     }
     GroupedPlots = groupedPlots;
     Position     = FigureWriter.FigurePositions.htbp;
     Caption      = caption;
     Label        = Helper.Marker();
     Landscape    = false;
 }
    protected override float SnapFloat(float value, AxisOptions snapAxis)
    {
        if (value == 0)
        {
            return(value);
        }

        if (axisOptions == AxisOptions.Both)
        {
            float angle = Vector2.Angle(input, Vector2.up);
            if (snapAxis == AxisOptions.Horizontal)
            {
                if (angle < 0.0f + horizontalSensitivity || angle > 180.0f - horizontalSensitivity)
                {
                    return(0);
                }
                else
                {
                    return((value > 0) ? 1 : -1);
                }
            }
            else if (snapAxis == AxisOptions.Vertical)
            {
                if (angle > 90.0f - verticalSensitivity && angle < 90.0f + verticalSensitivity)
                {
                    return(0);
                }
                else
                {
                    return((value > 0) ? 1 : -1);
                }
            }
            return(value);
        }
        else
        {
            if (value > 0)
            {
                return(1);
            }
            if (value < 0)
            {
                return(-1);
            }
        }
        return(0);
    }
        protected AxisOptions GetAxisOptionsForPlot(PaneData <TXValue, TYValue> plot, List <AxisOptions.GroupLine> groupLines = null)
        {
            var axisOptions = new AxisOptions(DefaultConverter.Instance)
            {
                Title           = plot.Caption,
                YLabel          = plot.Axis.Caption,
                BackgroundColor = _diagramBackColor.Name,
                YMode           = plot.Axis.Scaling == Scalings.Log ? AxisOptions.AxisMode.log : AxisOptions.AxisMode.normal,
                XMode           = plot.ChartAxis.Scaling == Scalings.Log ? AxisOptions.AxisMode.log : AxisOptions.AxisMode.normal,
            };

            if (groupLines != null)
            {
                axisOptions.GroupLines = groupLines;
            }

            return(axisOptions);
        }
Beispiel #15
0
        private static AxisOptions getAxisOptionsForGroup()
        {
            var axisOptions = new AxisOptions(NoConverter.Instance)
            {
                YLabel               = "Concentration at t=100h",
                IsUsedForBoxPlots    = true,
                BoxPlotDrawDirection = AxisOptions.BoxPlotDrawDirections.y,
                YMode         = AxisOptions.AxisMode.normal,
                XTicks        = new[] { 1F, 2F },
                XTickLabels   = new[] { "Group A", "Group B" },
                XAxisPosition = AxisOptions.AxisXLine.bottom,
                YAxisPosition = AxisOptions.AxisYLine.left,
                YMajorGrid    = true,
                YAxisArrow    = true,
                EnlargeLimits = true
            };

            return(axisOptions);
        }
Beispiel #16
0
 float SnapFloat(float value, AxisOptions snapAxis)
 {
     if (value == 0)
     {
         return(value);
     }
     if (axisOption == AxisOptions.Both)
     {
         float angle = Vector2.Angle(input, Vector2.up);
         if (snapAxis == AxisOptions.Horizontal)
         {
             if (angle > 22.5f || angle < 157.5f)
             {
                 return(0f);
             }
             else
             {
                 return(value > 0f ? 1f : -1f);
             }
         }
         else if (snapAxis == AxisOptions.Vertical)
         {
             if (angle > 67.5f && angle < 112.5f)
             {
                 return(0f);
             }
             return(value);
         }
         else
         {
             if (value > 0f)
             {
                 return(1f);
             }
             if (value < 0f)
             {
                 return(-1f);
             }
         }
     }
     return(0f);
 }
        private static AxisOptions getAxisOptions()
        {
            var axisOptions = new AxisOptions(NoConverter.Instance)
            {
                Title         = "Test Title",
                YLabel        = "Y Axis",
                YMode         = AxisOptions.AxisMode.normal,
                XAxisPosition = AxisOptions.AxisXLine.bottom,
                YAxisPosition = AxisOptions.AxisYLine.left,
                YMajorGrid    = true,
                YAxisArrow    = true,
                XAxisArrow    = true,
                EnlargeLimits = true,
                LegendOptions = new LegendOptions {
                    Columns = 1, LegendPosition = LegendOptions.LegendPositions.OuterNorthEast
                }
            };

            return(axisOptions);
        }
        private static AxisOptions getAxisOptionsForInterval(LegendOptions.LegendPositions legendPosition)
        {
            var axisOptions = new AxisOptions(NoConverter.Instance)
            {
                Title         = "Test Title",
                YLabel        = "Y Axis",
                YMode         = AxisOptions.AxisMode.normal,
                YMin          = 0F,
                XTicks        = new[] { 1F, 2F, 3F, 4F },
                XAxisPosition = AxisOptions.AxisXLine.bottom,
                YAxisPosition = AxisOptions.AxisYLine.left,
                YMajorGrid    = true,
                YAxisArrow    = true,
                EnlargeLimits = false,
                LegendOptions = new LegendOptions {
                    Columns = 1, LegendPosition = legendPosition
                }
            };

            return(axisOptions);
        }
Beispiel #19
0
    /// <summary>
    /// 斷裂浮動
    /// </summary>
    /// <param name="value"></param>
    /// <param name="snapAxis">斷裂浮動的軸</param>
    /// <returns></returns>
    private float SnapFloat(float value, AxisOptions snapAxis)
    {
        //如果輸入方向為0,則立刻返回(即操縱桿沒有被操控)
        if (value == 0)
        {
            return(value);
        }

        if (axisOptions == AxisOptions.Both)
        {
            float angle = Vector2.Angle(input, Vector2.up); //角度計算(計算: 控制值{input(x,y)} 與 固定值{Vector(0,1)} 基於中心0的夾角)
            if (snapAxis == AxisOptions.Horizontal)         //計算水平值
            {
                return((angle < 22.5f || angle > 157.5f) ? 0 : ((value > 0) ? 1 : -1));
            }

            if (snapAxis == AxisOptions.Vertical)   //計算垂直值
            {
                return((angle > 67.5f && angle < 112.5f) ? 0 : ((value > 0) ? 1 : -1));
            }

            return(value);
        }

        #region 方向值控制 (-1為反方向)
        if (value > 0)
        {
            return(1);
        }

        if (value < 0)
        {
            return(-1);
        }
        #endregion

        return(0);
    }
 public PlotTwoOrdinates(IEnumerable <Color> colors, AxisOptions axisOptions, IEnumerable <TeX.PGFPlots.Plot> plots, AxisOptions axisOptionsY2, IEnumerable <TeX.PGFPlots.Plot> plotsY2, Text caption) :
     base(colors, axisOptions, plots, caption)
 {
     AxisOptionsY2 = axisOptionsY2;
     PlotsY2       = plotsY2;
 }
        private void PlotFigures(string chapterName, List <Coordinate> coordinates, Text chapterTitle = null)
        {
            if (chapterTitle == null)
            {
                chapterTitle = new Text(chapterName);
            }

            _objectsToReport.Add(new Chapter(chapterName, chapterTitle));

            var colors = new List <Color>()
            {
                Color.Blue, Color.Red
            };

            var axisOptions = new AxisOptions(NoConverter.Instance)
            {
                Title  = "Test Title",
                XLabel = "X Axis",
                YLabel = "Y Axis",
                YMode  = AxisOptions.AxisMode.log,
                LogTicksWithFixedPoint = true,
                XAxisPosition          = AxisOptions.AxisXLine.bottom,
                YAxisPosition          = AxisOptions.AxisYLine.left,
                LegendOptions          = new LegendOptions {
                    LegendPosition = LegendOptions.LegendPositions.NorthWest
                },
                YMajorGrid = true
            };

            var plotOptions1 = new PlotOptions
            {
                LineStyle       = PlotOptions.LineStyles.Solid,
                Marker          = PlotOptions.Markers.Triangle,
                Color           = Color.Blue.Name,
                ErrorBars       = true,
                ShadedErrorBars = true,
                Thickness       = PlotOptions.Thicknesses.UltraThick
            };
            var plot1 = new Plot(coordinates, plotOptions1)
            {
                LegendEntry = "legend entry 1"
            };
            var plotItem = new TeXReporting.Items.Plot(colors, axisOptions, new List <Plot> {
                plot1
            }, new Text("Test Figure"));

            var plotOptions2 = new PlotOptions
            {
                LineStyle     = PlotOptions.LineStyles.DashDotted,
                Marker        = PlotOptions.Markers.Circle,
                Color         = Color.Red.Name,
                ErrorBars     = true,
                ThicknessSize = Helper.Length(2, Helper.MeasurementUnits.pt),
                MarkSize      = Helper.Length(3, Helper.MeasurementUnits.pt),
                MarkColor     = Color.Blue.Name,
                MarkFillColor = String.Format("{0}!{1}", Color.Blue.Name, 20)
            };
            var plot2 = new Plot(coordinates, plotOptions2)
            {
                LegendEntry =
                    "0123456789 0123456789 0123456789 0123456789 0123456789 0123456789"
            };
            var plotItem2 = new TeXReporting.Items.Plot(colors, axisOptions, new List <Plot> {
                plot2
            }, new Text("Test Figure 2"));

            // Two Ordinates Plot
            var axisOptionsY1 = new AxisOptions(NoConverter.Instance)
            {
                EnlargeLimits   = true,
                Title           = "Test Title",
                XLabel          = "X Axis",
                YLabel          = "Y Axis",
                YMin            = 0,
                XTickMin        = 2F,
                XTickMax        = 3F,
                MinorXTickNum   = 1,
                MinorYTickNum   = 1,
                BackgroundColor = "blue!10",
                YMode           = AxisOptions.AxisMode.normal,
                XAxisPosition   = AxisOptions.AxisXLine.bottom,
                YAxisPosition   = AxisOptions.AxisYLine.left,
                YMajorGrid      = true
            };
            var axisOptionsY2 = new AxisOptions(DefaultConverter.Instance)
            {
                YLabel        = "Y2 Axis",
                YAxisPosition = AxisOptions.AxisYLine.right,
                YAxisArrow    = false,
                YScaledTicks  = false,
                YMode         = AxisOptions.AxisMode.log,
                LegendOptions =
                    new LegendOptions
                {
                    FontSize        = LegendOptions.FontSizes.scriptsize,
                    LegendAlignment = LegendOptions.LegendAlignments.left,
                    LegendPosition  = LegendOptions.LegendPositions.OuterNorthWest,
                    RoundedCorners  = true,
                    Columns         = 1,
                    //TextWidth = Helper.GetWidthInPercentageOfTextWidth(30)
                },
                XAxisPosition = AxisOptions.AxisXLine.none
            };
            var plotTwoOrdinates = new PlotTwoOrdinates(colors, axisOptionsY1, new List <Plot> {
                plot1
            },
                                                        axisOptionsY2, new List <Plot> {
                plot2
            },
                                                        new Text("Test Two Ordinates"));

            var axisOptionsY3 = new AxisOptions(DefaultConverter.Instance)
            {
                YLabel         = "Y3 Axis",
                YAxisPosition  = AxisOptions.AxisYLine.right,
                YAxisArrow     = false,
                YScaledTicks   = true,
                YMin           = 0,
                YDiscontinuity = AxisOptions.Discontinuities.parallel,
                YMode          = AxisOptions.AxisMode.normal,
                LegendOptions  =
                    new LegendOptions
                {
                    FontSize        = LegendOptions.FontSizes.scriptsize,
                    LegendAlignment = LegendOptions.LegendAlignments.left,
                    LegendPosition  = LegendOptions.LegendPositions.OuterNorthEast,
                    RoundedCorners  = true,
                    Columns         = 1,
                    //TextWidth = Helper.GetWidthInPercentageOfTextWidth(30)
                },
                XAxisPosition = AxisOptions.AxisXLine.none
            };

            var plot3 = new Plot(new List <Coordinate> {
                new Coordinate(2.5F, 5F)
            },
                                 new PlotOptions {
                Marker = PlotOptions.Markers.Triangle
            })
            {
                LegendEntry = "Points"
            };

            var plotThreeOrdinates = new PlotThreeOrdinates(colors, axisOptionsY1, new List <Plot> {
                plot1
            },
                                                            axisOptionsY2, new List <Plot> {
                plot2
            },
                                                            axisOptionsY3, new List <Plot> {
                plot3
            },
                                                            new Text("Test Three Ordinates"));


            _objectsToReport.Add(new Section("Simple Figure 1"));
            var axisOptionsNormal = new AxisOptions(NoConverter.Instance)
            {
                Title  = "Test Title",
                XLabel = "X Axis",
                YLabel = "Y Axis",
                YMode  = AxisOptions.AxisMode.normal,
                LogTicksWithFixedPoint = true,
                XAxisPosition          = AxisOptions.AxisXLine.bottom,
                YAxisPosition          = AxisOptions.AxisYLine.left,
                LegendOptions          = new LegendOptions {
                    LegendPosition = LegendOptions.LegendPositions.NorthWest
                },
                YMajorGrid = true
            };
            var plotItemNormal = new TeXReporting.Items.Plot(plotItem.Colors, axisOptionsNormal, plotItem.Plots, new Text("Test Figure with normal scaled Y-Axis"));

            _objectsToReport.Add(plotItemNormal);
            _figureCounter++;


            _objectsToReport.Add(new Section("Simple Figure 2"));
            _objectsToReport.Add(plotItem);
            _figureCounter++;

            _objectsToReport.Add(new Section("Simple Figure 3"));
            _objectsToReport.Add(plotItem2);
            _figureCounter++;

            _objectsToReport.Add(new Section("Two Ordinates Figure"));
            _objectsToReport.Add(plotTwoOrdinates);
            _figureCounter++;

            _objectsToReport.Add(new Section("Three Ordinates Figure"));
            _objectsToReport.Add(plotThreeOrdinates);
            _figureCounter++;
        }
Beispiel #22
0
 public PlotThreeOrdinates(IEnumerable <Color> colors, AxisOptions axisOptions, IEnumerable <TeX.PGFPlots.Plot> plots, AxisOptions axisOptionsY2, IEnumerable <TeX.PGFPlots.Plot> plotsY2, AxisOptions axisOptionsY3, IEnumerable <TeX.PGFPlots.Plot> plotsY3, Text caption) :
     base(colors, axisOptions, plots, axisOptionsY2, plotsY2, caption)
 {
     AxisOptionsY3 = axisOptionsY3;
     PlotsY3       = plotsY3;
 }
Beispiel #23
0
 public BarPlot(IEnumerable <Color> colors, AxisOptions axisOptions, BarPlotOptions barPlotOptions, IEnumerable <TeX.PGFPlots.Plot> plots, Text caption)
     : base(colors, axisOptions, plots, caption)
 {
     BarPlotOptions = barPlotOptions;
 }
Beispiel #24
0
 public BasePlot(AxisOptions axisOptions, IEnumerable <TeX.PGFPlots.Plot> plots)
 {
     AxisOptions = axisOptions;
     _plots      = new List <TeX.PGFPlots.Plot>(plots);
 }
        public override void OnInspectorGUI()
        {
            // get script
            RuntimeHelperTranslate script = (RuntimeHelperTranslate)target;

            // build pose reader
            EditorGUILayout.LabelField("Pose Reader", EditorStyles.boldLabel);
            script.poseReader = (YawPitchRoll)EditorGUILayout.ObjectField(
                "Pose Reader",
                script.poseReader,
                typeof(YawPitchRoll),
                true
                );

            // build pose reader axis
            AxisOptions axis = (AxisOptions)script._defaultAxis;

            script._defaultAxis = (int)(AxisOptions)EditorGUILayout.EnumPopup("Axis", axis);

            // build settings
            EditorGUILayout.LabelField("Settings", EditorStyles.boldLabel);

            // build multiplier
            script.multiplier = EditorGUILayout.FloatField("Multiplier", script.multiplier);

            // build reverse direction
            bool reverseDirection = (script._directionMultiplier == 1) ? true : false;

            reverseDirection            = EditorGUILayout.Toggle("Reverse Direction", reverseDirection);
            script._directionMultiplier = (reverseDirection == true) ? 1 : -1;

            // build reverse offset
            bool reverseOffset = (script._blockMultiplier == 1) ? true : false;

            reverseOffset           = EditorGUILayout.Toggle("Reverse Offset", reverseOffset);
            script._blockMultiplier = (reverseOffset == true) ? 1 : -1;

            // build curve
            EditorGUILayout.LabelField("Curve", EditorStyles.boldLabel);

            // build extremes
            translationExtremes.Set(script._negValue, script._posValue);
            translationExtremes = EditorGUILayout.Vector2Field("Translation Extremes", translationExtremes);
            script._negValue    = translationExtremes.x;
            script._posValue    = translationExtremes.y;

            // build placement
            EditorGUILayout.LabelField("Placement", EditorStyles.boldLabel);

            // build default position
            defaultPosition.Set(script._defaultPositionX, script._defaultPositionY, script._defaultPositionZ);
            defaultPosition          = EditorGUILayout.Vector3Field("Default Position", defaultPosition);
            script._defaultPositionX = defaultPosition.x;
            script._defaultPositionY = defaultPosition.y;
            script._defaultPositionZ = defaultPosition.z;

            // build offset position
            offsetPosition.Set(script.offsetX, script.offsetY, script.offsetZ);
            offsetPosition = EditorGUILayout.Vector3Field("Offset Position", offsetPosition);
            script.offsetX = offsetPosition.x;
            script.offsetY = offsetPosition.y;
            script.offsetZ = offsetPosition.z;
        }
Beispiel #26
0
        static void Main(string[] args)
        {
            var curDir = Directory.GetCurrentDirectory();

            Console.WriteLine($"Current Directory: {curDir}");
            try
            {
                var months = 12;

                var FileName = "democharts.js";

                Random r = new Random();

                var Data1 = new Dataset()
                {
                    Name      = "Data 1",
                    ChartType = ChartTypes.line,
                    Values    = Enumerable.Range(0, months)
                                .Select(x => r.Next(1000))
                                .Select(y => (object)y)
                                .ToArray()
                };

                var Data2 = new Dataset()
                {
                    Name      = "Data 2",
                    ChartType = ChartTypes.line,
                    Values    = Enumerable.Range(0, months)
                                .Select(x => r.Next(1000))
                                .Select(y => (object)y)
                                .ToArray()
                };


                var labels = Enumerable.Range(0, months)
                             .Select(i => DateTime.Now.AddMonths(i - months))
                             .Select(date => date.ToString("MMM yyyy"))
                             .ToArray();


                var lineOptions = new LineOptions()
                {
                    Heatline   = true,
                    RegionFill = true,
                    DotSize    = 5
                };

                var axisOption = new AxisOptions()
                {
                    XAxisMode = AxisModes.tick
                };

                var FrappeChart = new FrappeChart("#FrappeChart", "FrappeChart")
                {
                    Options = new ChartOptions()
                    {
                        Title  = $"Chart Title",
                        Height = 350,
                        Data   = new ChartData()
                        {
                            Labels   = labels,
                            Datasets = new Dataset[] {
                                Data1,
                                Data2
                            }
                        },
                        Type             = ChartTypes.line,
                        ValuesOverPoints = false,
                        LineOptions      = lineOptions,
                        AxisOptions      = axisOption,
                        Colors           = new string[] { "#5bcaff", "#ff82d0" }
                    }
                };

                Console.WriteLine($"Saving Chart to file '{FileName}'");
                File.WriteAllText(FileName, FrappeChart.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine($"Starting default browser with 'index.html'");
            Process proc = new Process();

            proc.StartInfo.UseShellExecute = true;
            proc.StartInfo.FileName        = "index.html";
            proc.Start();
        }
Beispiel #27
0
 // Apply axis options to the vector parameter
 private Vector2 LimitVectorAxis(Vector2 vec, AxisOptions axisOption)
 {
     return(new Vector2(((axisOption == AxisOptions.Vertical) ? 0f : vec.x), ((axisOption == AxisOptions.Horizontal) ? 0f : vec.y)));
 }