public void Init()
        {
            SymbolInfo properties = new SymbolPropertiesImpl();

            data = new DataImpl(properties, 10000, 1000);
            data.AddInterval(IntervalsInternal.Hour1);

            tickReader = new TickZoom.TickUtil.TickReader();
            tickReader.Initialize("TestData", "USD_JPY");
        }
Esempio n. 2
0
 protected override void RenderChipValue(RenderTreeBuilder builder)
 {
     if ((chipValue is null) && (Value != null) && (DataImpl != null))
     {
         // fallback for initial rendering without chipValue
         // does not help when DataImpl is not set yet (loaded asynchronously)
         var item = DataImpl.FirstOrDefault(item => comparer.Equals(Value, SelectorHelpers.GetValue <TItem, TValue>(ValueSelectorImpl, item)));
         chipValue = SelectorHelpers.GetText(TextSelectorImpl, item);
     }
     builder.AddContent(0, chipValue);
 }
Esempio n. 3
0
        /// <summary>
        /// Visualize the given object by generating DOT which can be rendered with GraphViz.
        /// </summary>
        ///
        /// <example>
        ///
        /// // 1) Generate a DOT file for an object
        /// File.WriteAllText("object.dot", new ObjectGraphVisualizer().Visualize(obj));
        ///
        /// // 2) Render a graph for the using (internal).
        ///
        /// <returns>
        /// DOT, which can be rendered with GraphViz
        /// </returns>
        ///
        /// <param name="obj">
        /// Object to visualize
        /// </param>
        ///
        /// <param name="data">
        /// Analyzed graph data.
        /// </param>
        public string Visualize(object obj, out IData data)
        {
            // Build the graph
            DataImpl dataImpl = new DataImpl(obj);

            data = dataImpl;
            int           nextNodeId  = 1;
            StringBuilder tempBuilder = new StringBuilder(64);

            AddObject(dataImpl.DataNodes, obj, tempBuilder, ref nextNodeId, true);

            return(CreateDOT(dataImpl.DataNodes, dataImpl));
        }
Esempio n. 4
0
        private void RefreshState()
        {
            if (DataImpl != null)
            {
                itemsToRender = DataImpl.ToList();

                // AutoSort
                if (AutoSortImpl && (itemsToRender.Count > 1))
                {
                    if (SortKeySelectorImpl != null)
                    {
                        itemsToRender = itemsToRender.OrderBy(this.SortKeySelectorImpl).ToList();
                    }
                    else if (TextSelectorImpl != null)
                    {
                        itemsToRender = itemsToRender.OrderBy(this.TextSelectorImpl).ToList();
                    }
                    else
                    {
                        itemsToRender = itemsToRender.OrderBy(i => i.ToString()).ToList();
                    }
                }

                // set next properties for rendering
                selectedItemIndex = itemsToRender.FindIndex(item => comparer.Equals(Value, SelectorHelpers.GetValue <TItem, TValue>(ValueSelectorImpl, item)));

                if ((Value != null) && (selectedItemIndex == -1))
                {
                    throw new InvalidOperationException($"Data does not contain item for current value '{Value}'.");
                }
            }
            else
            {
                itemsToRender     = null;
                selectedItemIndex = -1;
            }
        }
Esempio n. 5
0
 public OrderManager()
 {
     DataFactory = new DataImpl();
 }
Esempio n. 6
0
        /// <summary>
        /// Generates DOT graph serialization for a graph.
        /// </summary>
        /// <param name="nodes">The node graph.</param>
        /// <param name="data">Output data to populate</param>
        /// <returns>DOT graph string.</returns>
        private string CreateDOT(Dictionary <object, Node> nodes, DataImpl data)
        {
            StringBuilder output = new StringBuilder(1024 * 64);

            // Write the header
            output.Append("digraph\n");
            output.Append("{\n");


            output.Append("    graph [splines=ortho]\n");
            output.Append("    node [shape=box style=rounded]\n");

            // Write the mappings from ID to label
            foreach (Node node in nodes.Values)
            {
                output.Append("    ");
                output.Append(node.Id);
                output.Append(" [ label=\"");
                output.Append($"{node.Object.GetType().Namespace}.{node.Object.GetType().Name}");
                output.Append("\"");

                if (node.WasTruncated)
                {
                    data.TruncatedNodes.Add(node.Object);
                    output.Append(" id=\"googlered\"");
                }
                else if (node.IsRoot)
                {
                    if (node.OutLinks.Any())
                    {
                        data.InternalNodes.Add(node.Object);
                    }
                    else
                    {
                        data.LeafNodes.Add(node.Object);
                    }
                    output.Append(" id=\"dark googlegreen\"");
                }
                else if (!node.OutLinks.Any())
                {
                    data.LeafNodes.Add(node.Object);
                    output.Append(" id=\"dark googlered\"");
                }
                else
                {
                    data.InternalNodes.Add(node.Object);
                }

                output.Append(" ];\n");
            }

            // Write the node connections
            foreach (Node node in nodes.Values)
            {
                foreach (KeyValuePair <string, int> pair in node.OutLinks)
                {
                    output.Append("    ");
                    output.Append(node.Id);
                    output.Append(" -> ");
                    output.Append(pair.Value);
                    output.Append(" [ label=\"");
                    output.Append(pair.Key);
                    output.Append("\" ];\n");
                }
            }

            // Write the footer
            output.Append("}\n");

            return(output.ToString());
        }