public String buildOneDimensionalChart <T>(chartTypeEnum chartType, String title, List <T> source, Func <T, String> label, Func <T, String> value, Func <T, String> color = null)
        {
            var fields = GetDefaultValues();

            fields.Add("title", title);

            //List<String> color_set = new List<string>() { "69D2E7", "#E0E4CC", "#F38630", "#96CE7F", "#CEBC17", "#CE4264" };
            circularSelector <String> color_selector = new circularSelector <String>("69D2E7", "#E0E4CC", "#F38630", "#96CE7F", "#CEBC17", "#CE4264");


            foreach (T item in source)
            {
                String label_str = label(item);
                String value_str = value(item);
                String color_str = "";
                if (color == null)
                {
                    color_str = color_selector.next();
                }
                else
                {
                    color_str = color(item);
                }
                fields["colors"] = fields["colors"].add(color_str, ",");
                fields["data"]   = fields["data"].add(value_str, ",");
                fields["labels"] = fields["labels"].add(label_str, ",");
            }
            stringTemplate template = new stringTemplate(chartTemplate[chartType]);

            return(template.applyToContent(fields));
        }
Example #2
0
        public static String GetCrawlFolderName(ISpiderEvaluatorBase spider, crawlerDomainTaskMachineSettings crawlerJobEngineSettings, String templateString)
        {
            stringTemplate template = new stringTemplate(templateString);

            PropertyCollection data = GetData(crawlerJobEngineSettings, spider);

            return(template.applyToContent(data));
        }
Example #3
0
        public static String GetCrawlFolderName(ISpiderEvaluatorBase spider, ICrawlJobContext state, String templateString)
        {
            stringTemplate template = new stringTemplate(templateString);

            PropertyCollection data = GetData(state, spider);

            return(template.applyToContent(data));
        }
Example #4
0
        public String buildTwoDimensionalChart(chartTypeEnum chartType, DataTable dataTable, params String[] columns)
        {
            JSONChartDataTool tool = new JSONChartDataTool();

            String data   = tool.DataToJ3CodeData(dataTable, columns);
            var    fields = GetDefaultValues();

            fields.Add("title", dataTable.GetTitle().getFilename());
            fields["data"] = data;
            stringTemplate template = new stringTemplate(chartTemplate[chartType]);

            return(template.applyToContent(fields));
        }
        public String buildTwoDimensionalChart <T>(chartTypeEnum chartType, String title, List <T> source, Func <T, String> label, Func <T, String> color = null, params Func <T, String>[] value)
        {
            var fields = GetDefaultValues();

            fields.Add("title", title);

            //List<String> color_set = new List<string>() { "69D2E7", "#E0E4CC", "#F38630", "#96CE7F", "#CEBC17", "#CE4264" };

            List <String> value_str = new List <string>();

            foreach (var f in value)
            {
                value_str.Add("");//.Add(f(item));
            }


            foreach (T item in source)
            {
                String label_str = label(item);

                for (int i = 0; i < value.Length; i++)
                {
                    value_str[i] = value_str[i].add(value[i](item), ",");
                }

                //String value_str = value(item);
                String color_str = "";
                if (color == null)
                {
                    color_str = color_selector.next();
                }
                else
                {
                    color_str = color(item);
                }
                fields["colors"] = fields["colors"].add(color_str, ",");

                fields["labels"] = fields["labels"].add(label_str, ",");
            }

            foreach (var f in value_str)
            {
                fields["data"] = fields["data"].add(f, " next ");
            }



            stringTemplate template = new stringTemplate(chartTemplate[chartType]);

            return(template.applyToContent(fields));
        }
Example #6
0
        /// <summary>
        /// Creates message collections
        /// </summary>
        /// <param name="loger">The loger.</param>
        /// <param name="workspace">The workspace.</param>
        /// <param name="showMessage">if set to <c>true</c> [show message].</param>
        /// <returns></returns>
        public List <emailMessageCollection> createCollections(ILogBuilder loger, folderNode workspace, Boolean showMessage = true)
        {
            List <emailMessageCollection> output = new List <emailMessageCollection>();

            stringTemplate subject = new stringTemplate(subjectTemplate);

            stringTemplate content = new stringTemplate(contentTemplate);

            stringTemplate address = new stringTemplate(addressTemplate);

            emailMessageCollection messageCollection = new emailMessageCollection();

            messageCollection.name = "block01";
            output.Add(messageCollection);

            foreach (DataRow row in dataSource.Rows)
            {
                emailMessage message = new emailMessage();
                message.from    = fromAddress;
                message.content = content.applyToContent(row);
                message.subject = subject.applyToContent(row);
                message.address = address.applyToContent(row);

                if (showMessage)
                {
                    loger.AppendLine("Subject: " + message.subject);
                    loger.AppendLine("Content: " + message.content);
                }

                messageCollection.Add(message);
                if (messageCollection.Count >= collectionSize)
                {
                    messageCollection.Save(workspace.pathFor(messageCollection.name + ".xml", imbSCI.Data.enums.getWritableFileMode.overwrite, "Block of messages", true));
                    messageCollection      = new emailMessageCollection();
                    messageCollection.name = "block" + output.Count.ToString("D2");
                    output.Add(messageCollection);
                    loger.log("Message block created: " + messageCollection.name);
                }
            }

            messageCollection.Save(workspace.pathFor(messageCollection.name + ".xml", imbSCI.Data.enums.getWritableFileMode.overwrite, "Block of messages", true));

            return(output);
        }
Example #7
0
        public String buildOneDimensionalChart <T>(chartTypeEnum chartType, String title, Dictionary <String, Double> source)
        {
            var fields = GetDefaultValues();

            fields.Add("title", title);

            //List<String> color_set = new List<string>() { "69D2E7", "#E0E4CC", "#F38630", "#96CE7F", "#CEBC17", "#CE4264" };
            circularSelector <String> color_selector = new circularSelector <String>("69D2E7", "#E0E4CC", "#F38630", "#96CE7F", "#CEBC17", "#CE4264");


            foreach (var item in source)
            {
                String data = "columns: -:: ";

                String column = "-:: !" + item.Key + "!".add(item.Value.ToString(), ", ") + " ::-";

                fields["data"] = fields["data"].add(column, ", ");

                fields["data"] += " ::-";
            }
            stringTemplate template = new stringTemplate(chartTemplate[chartType]);

            return(template.applyToContent(fields));
        }
 public void AppendColor(aceColorPalette paleta, stringTemplate template, PropertyCollection data)
 {
 }