private void RenderHeadline(ExcelWriter writer)
        {
            int a = 0;

            foreach (LinkBiDefinitionDimension filter in this.Definition.Dimensions)
            {
                DefinitionObject _filter = new DefinitionObject(
                    this.Core,
                    this.Definition.FileName,
                    filter.XmlNode
                    );

                //writer.Write(a++, 0, filter.Name);
                writer.Write(a++, 0, _filter.GetLabel(this.Definition.Settings.IdLanguage));
            }

            //foreach (LinkBiDefinitionDimension measure in this.Definition.Measures)
            //{
            writer.Write(a++, 0, "variablename");
            writer.Write(a++, 0, "response");
            //}

            if (this.DisplayUnweightedBase)
            {
                writer.Write(a++, 0, "unweighted base");
            }


            if (this.DisplayEffectiveBase)
            {
                writer.Write(a++, 0, "Effective base");
            }

            writer.Write(a++, 0, "base");
            writer.Write(a++, 0, "value");

            if (this.ExportPercentage)
            {
                writer.Write(a++, 0, "percentage");
            }
        }
Example #2
0
        private string[] RenderHeadline()
        {
            foreach (LinkBiDefinitionDimension filter in this.Definition.Dimensions)
            {
                DefinitionObject _filter = new DefinitionObject(
                    this.Core,
                    this.Definition.FileName,
                    filter.XmlNode
                    );

                if (sbFieldNames.ToString() == "")
                {
                    sbFieldNames.Append("[");
                    sbFieldTypes.Append("[");
                }

                sbFieldNames.Append("\"" + _filter.GetLabel(this.Definition.Settings.IdLanguage) + "\",");
                sbFieldTypes.Append("\"string\",");
            }

            sbFieldNames.Append("\"variablename\",");
            sbFieldTypes.Append("\"string\",");

            sbFieldNames.Append("\"responses\",");
            sbFieldTypes.Append("\"string\",");

            if (this.DisplayUnweightedBase)
            {
                sbFieldNames.Append("\"unweighted base\",");
                sbFieldTypes.Append("\"float\",");
            }

            if (this.DisplayEffectiveBase)
            {
                sbFieldNames.Append("\"Effective base\",");
                sbFieldTypes.Append("\"float\",");
            }

            sbFieldNames.Append("\"base\",");
            sbFieldTypes.Append("\"float\",");

            sbFieldNames.Append("\"value\",");
            sbFieldTypes.Append("\"float\",");


            if (this.ExportPercentage)
            {
                sbFieldNames.Append("\"percentage\",");
                sbFieldTypes.Append("\"float\",");
            }

            sbFieldNames = sbFieldNames.Remove(sbFieldNames.Length - 1, 1);
            sbFieldTypes = sbFieldTypes.Remove(sbFieldTypes.Length - 1, 1);

            sbFieldNames.Append("]");
            sbFieldTypes.Append("]");


            return(new string[]
            {
                sbFieldNames.ToString(),
                sbFieldTypes.ToString(),
            });
        }
        public override void Render(StringBuilder writer, HierarchyFilter hierarchyFilter)
        {
            string[] chartingColors = LoadChartingColors();
            int      i = 0;
            // Select the xml node that contains the chart's data.
            XmlNodeList xmlNodes = this.Document.SelectNodes(this.PathDimension + "/*[not(self::Variable)][not(self::MeanScore)]");

            // Open an array for the values.
            writer.Append("[");

            // FOR TEST ONLY:
            foreach (XmlNode xmlNodeCategory in xmlNodes)
            {
                if (xmlNodeCategory.ParentNode.Attributes["IsNestedBase"] != null &&
                    bool.Parse(xmlNodeCategory.ParentNode.Attributes["IsNestedBase"].Value) == true)
                {
                    continue;
                }

                if (xmlNodeCategory.Attributes["ShowInChart"] != null && bool.Parse(xmlNodeCategory.Attributes["ShowInChart"].Value) == false)
                {
                    continue;
                }

                DefinitionObject test = new DefinitionObject(
                    base.Core,
                    this.Source,
                    string.Format(
                        "//Variable/{0}[@Id=\"{1}\"]",
                        xmlNodeCategory.Name,
                        xmlNodeCategory.Attributes["Id"].Value
                        )
                    );

                object enabled = test.GetValue("Enabled");

                if (enabled != null && bool.Parse((string)enabled) == false)
                {
                    continue;
                }

                writer.Append("{");

                Guid idCategory = Guid.Parse(xmlNodeCategory.Attributes["Id"].Value);

                string categoryName  = (string)test.GetValue("Name");
                string categoryLabel = (string)test.GetLabel(base.IdLanguage);

                XmlNode xmlNode = xmlNodeCategory.SelectSingleNode("Variable[@IsNestedBase=\"True\"]");

                if (xmlNode == null)
                {
                    xmlNode = xmlNodeCategory.SelectSingleNode("Variable");
                }

                if (xmlNode == null)
                {
                    xmlNode = xmlNodeCategory;
                }

                double value     = 0.0;
                double baseValue = 0;
                if (xmlNode.Attributes["Value"] != null)
                {
                    if (xmlNode.Attributes["Value"] != null)
                    {
                        value = double.Parse(xmlNode.Attributes["Value"].Value);
                    }

                    if (xmlNode.ParentNode.Attributes["Position"].Value == "Top")
                    {
                        if (xmlNode.ParentNode.Attributes["Base"] != null)
                        {
                            baseValue = double.Parse(xmlNode.ParentNode.Attributes["Base"].Value);
                        }
                    }
                    else
                    {
                        if (xmlNode.Attributes["Base"] != null)
                        {
                            baseValue = double.Parse(xmlNode.Attributes["Base"].Value);
                        }
                    }
                }
                else
                {
                    if (xmlNode.Attributes["Base"] != null)
                    {
                        value = double.Parse(xmlNode.Attributes["Base"].Value);
                    }
                    if (xmlNode.Attributes["VariableBase"] != null)
                    {
                        baseValue = double.Parse(xmlNode.Attributes["VariableBase"].Value);
                    }
                    else if (xmlNodeCategory.ParentNode.Attributes["Base"] != null)
                    {
                        baseValue = double.Parse(xmlNodeCategory.ParentNode.Attributes["Base"].Value);
                    }
                }

                /*if (xmlNodeCategory.Attributes["Base"] != null)
                 *  value = double.Parse(xmlNodeCategory.Attributes["Base"].Value);
                 * else if (xmlNodeCategory.ParentNode.Attributes["Base"] != null)
                 *  value = double.Parse(xmlNodeCategory.ParentNode.Attributes["Base"].Value);
                 *
                 * if (xmlNode.Attributes["Value"] != null)
                 * {
                 *  baseValue = value;
                 *  value = double.Parse(xmlNode.Attributes["Value"].Value);
                 * }
                 * else
                 * {
                 *  if (xmlNodeCategory.ParentNode.Attributes["Base"] != null)
                 *      baseValue = double.Parse(xmlNodeCategory.ParentNode.Attributes["Base"].Value);
                 * }*/

                if (baseValue != 0)
                {
                    value = value * 100 / baseValue;
                }
                else
                {
                    value = 0;
                }

                if (chartingColors.Length == i)
                {
                    i = 0;
                }

                writer.Append(string.Format(
                                  "\"dimension\": \"{0}\", \"value\": \"{1}\", \"Label\": \"{2}\",\"Color_{0}\": \"{3}\"",
                                  categoryName,
                                  value.ToString(new CultureInfo(2057)),
                                  HttpUtility.HtmlEncode(categoryLabel),
                                  chartingColors[i++]
                                  ));

                if (xmlNodeCategory.ChildNodes.Count > 0 && xmlNodeCategory.FirstChild.Attributes["Id"].Value != "00000000-0000-0000-0000-000000000000")
                {
                    writer.Append(string.Format(
                                      ", \"XPATH\": \"{0}\"",
                                      HttpUtility.UrlEncode(xmlNodeCategory.GetXPath(true) + "/Variable")
                                      ));
                }

                writer.Append("},");
            }

            if (xmlNodes.Count > 0)
            {
                writer = writer.Remove(writer.Length - 1, 1);
            }

            // Close the values array.
            writer.Append("]");
        }
        private void RenderMeasure(LinkBiDefinitionDimension measure, ExcelWriter writer, int columnOffset, Data filter = null)
        {
            DataCore.Classes.StorageMethods.Database storageMethod = new DataCore.Classes.StorageMethods.Database(
                base.Core,
                null
                );

            int rowOffset = i;

            if (measure.Type == VariableType.Numeric)
            {
                Data result = storageMethod.GetRespondentsNumeric(
                    measure.Identity,
                    measure.IsTaxonomy,
                    this.Core.CaseDataLocation,
                    filter,
                    this.Definition.WeightingFilters
                    );

                double baseValue     = result.Base;
                string uBaseValueStr = result.Responses.Count.ToString(new CultureInfo("en-GB"));
                string eBaseValueStr = result.Responses.Count.ToString(new CultureInfo("en-GB"));
                string baseValueStr  = baseValue.ToString(new CultureInfo("en-GB"));

                writer.Write(
                    columnOffset + 2,
                    i,
                    baseValueStr
                    );

                writer.Write(
                    columnOffset + 3,
                    i,
                    result.Responses.Values.Sum(x => x[0]).ToString(new CultureInfo("en-GB"))
                    );

                i++;

                if (totalToProcess != 0)
                {
                    int progress = i * 100 / totalToProcess;

                    if (progress == 100)
                    {
                        base.Progress = 99;
                    }
                    else
                    {
                        base.Progress = progress;
                    }
                }
            }
            else
            {
                filter = storageMethod.GetRespondents(
                    measure,
                    filter,
                    this.Definition.WeightingFilters
                    );

                double baseValue     = filter.Base;
                string uBaseValueStr = filter.Responses.Count.ToString(new CultureInfo("en-GB"));
                string eBaseValueStr = filter.Responses.Count.ToString(new CultureInfo("en-GB"));
                string baseValueStr  = baseValue.ToString(new CultureInfo("en-GB"));

                // Run through all scores of the measure.
                foreach (LinkBiDefinitionDimensionScore score in measure.Scores)
                {
                    if (score.Hidden)
                    {
                        continue;
                    }

                    if (measure.IsTaxonomy && score.Persistent &&
                        base.Definition.HierarchyFilter.TaxonomyCategories.ContainsKey(score.Identity) == false)
                    {
                        continue;
                    }

                    DefinitionObject _score = new DefinitionObject(
                        this.Core,
                        this.Definition.FileName,
                        score.XmlNode
                        );

                    /*writer.Write(
                     *  columnOffset + 1,
                     *  i,
                     *  score.Label
                     * );*/

                    writer.Write(
                        columnOffset + 1,
                        i,
                        _score.GetLabel(this.Definition.Settings.IdLanguage)
                        );

                    int columnOffset2 = 0;

                    if (this.DisplayUnweightedBase)
                    {
                        columnOffset2 = 1;

                        writer.Write(
                            columnOffset + 2,
                            i,
                            uBaseValueStr
                            );
                    }



                    if (this.DisplayEffectiveBase)
                    {
                        columnOffset2 = 1;

                        writer.Write(
                            columnOffset + 2,
                            i,
                            eBaseValueStr
                            );
                    }

                    writer.Write(
                        columnOffset + columnOffset2 + 2,
                        i,
                        baseValueStr
                        );

                    double value;

                    Data scoreFilter = score.GetRespondents(filter, this.StorageMethod);


                    value = scoreFilter.Value;

                    writer.Write(
                        columnOffset + columnOffset2 + 3,
                        i,
                        value.ToString(new CultureInfo("en-GB"))
                        );

                    if (this.ExportPercentage)
                    {
                        double percentage = (value * 100 / baseValue);

                        if (double.IsNaN(percentage))
                        {
                            percentage = 0.0;
                        }

                        writer.Write(
                            columnOffset + columnOffset2 + 4,
                            i,
                            percentage.ToString(new CultureInfo("en-GB"))
                            );
                    }

                    i++;

                    if (totalToProcess != 0)
                    {
                        int progress = i * 100 / totalToProcess;

                        if (progress == 100)
                        {
                            base.Progress = 99;
                        }
                        else
                        {
                            base.Progress = progress;
                        }
                    }
                }
            }

            for (int a = rowOffset; a < i; a++)
            {
                DefinitionObject _measure = new DefinitionObject(
                    this.Core,
                    this.Definition.FileName,
                    measure.XmlNode
                    );

                /*writer.Write(
                 *  columnOffset,
                 *  a,
                 *  measure.Label
                 * );*/
                writer.Write(
                    columnOffset,
                    a,
                    _measure.GetLabel(this.Definition.Settings.IdLanguage)
                    );
            }
        }
        private void RenderDimension(LinkBiDefinitionDimension dimension, ExcelWriter writer, int offset, Data dataFilter = null)
        {
            Data scoreFilter;

            // Run through all filter scores of the filter.
            foreach (LinkBiDefinitionDimensionScore score in dimension.Scores)
            {
                if (score.Hidden)
                {
                    continue;
                }

                if (dimension.IsTaxonomy && score.Persistent &&
                    base.Definition.HierarchyFilter.TaxonomyCategories.ContainsKey(score.Identity) == false)
                {
                    continue;
                }

                int rowOffset = i;

                scoreFilter = score.GetRespondents(dataFilter, this.StorageMethod);

                if (this.Definition.Dimensions.Count > (offset + 1))
                {
                    RenderDimension(
                        this.Definition.Dimensions[offset + 1],
                        writer,
                        offset + 1,
                        scoreFilter
                        );
                }
                else
                {
                    foreach (LinkBiDefinitionDimension measure in this.Definition.Measures)
                    {
                        RenderMeasure(
                            measure,
                            writer,
                            offset + 1,
                            scoreFilter
                            );
                    }
                }

                for (int a = rowOffset; a < i; a++)
                {
                    DefinitionObject _score = new DefinitionObject(
                        this.Core,
                        this.Definition.FileName,
                        score.XmlNode
                        );


                    /*writer.Write(
                     *  offset,
                     *  a,
                     *  score.Label
                     * );*/
                    writer.Write(
                        offset,
                        a,
                        _score.GetLabel(this.Definition.Settings.IdLanguage)
                        );
                }

                //i++;
            }
        }
Example #6
0
        private string RenderScoreToJson(DefinitionObject score, int idLanguage)
        {
            StringBuilder result = new StringBuilder();

            if (score.IsScoreGroup())
            {
                object _enabled = score.GetValue("Enabled");

                result.Append("{");
                result.Append(string.Format(
                                  " \"Type\": \"ScoreGroup\", \"Id\": \"{0}\", \"Name\": \"{1}\", \"Order\": \"{2}\", \"Path\": \"{3}\", \"Source\": \"{4}\", \"Value\": \"{5}\", \"Enabled\": {6}, \"Color\":\"{7}\", \"Scores\": [",
                                  score.GetValue("Id"),
                                  HttpUtility.HtmlEncode(score.GetLabel(idLanguage)),
                                  score.GetValue("Order"),
                                  score.Path.Replace("\"", "\\\""),
                                  score.Source,
                                  score.GetValue("Value"),
                                  _enabled != null ? _enabled.ToString().ToLower() : true.ToString().ToLower(),
                                  score.GetValue("Color")
                                  ));

                /*foreach (XmlNode xmlNodeScore in xmlNode.ChildNodes)
                 * {
                 *  result.Append(RenderScoreToJson(xmlNodeScore, idLanguage));
                 *  result.Append(",");
                 * }*/
                DefinitionObject[] childScores = score.GetChilds();
                foreach (DefinitionObject childScore in childScores)
                {
                    result.Append(RenderScoreToJson(childScore, idLanguage));
                    result.Append(",");
                }

                if (childScores.Length > 0)
                {
                    result = result.Remove(result.Length - 1, 1);
                }

                result.Append("] }");
            }
            else
            {
                object _enabled = score.GetValue("Enabled");

                result.Append("{");
                result.Append(string.Format(
                                  " \"Type\": \"{0}\", \"Id\": \"{1}\", \"Label\": \"{2}\", \"Order\": \"{3}\", \"Path\": \"{4}\", \"Enabled\": {5}, \"Source\": \"{6}\", \"Name\": \"{7}\", \"Value\": \"{8}\" ",
                                  score.TypeName,
                                  score.GetValue("Id"),
                                  HttpUtility.HtmlEncode(score.GetLabel(idLanguage)),
                                  score.GetValue("Order"),
                                  score.Path.Replace("\"", "\\\""),
                                  _enabled != null ? _enabled.ToString().ToLower() : true.ToString().ToLower(),
                                  score.Source,
                                  HttpUtility.HtmlEncode(score.GetValue("Name")),
                                  score.GetValue("Value")
                                  ));
                result.Append("}");
            }

            return(result.ToString());
        }
        private void RenderMeasure(LinkBiDefinitionDimension measure, StringBuilder writer, int columnOffset, string selection, Data filter = null)
        {
            DataCore.Classes.StorageMethods.Database storageMethod = new DataCore.Classes.StorageMethods.Database(
                base.Core,
                null
                );

            // Check if the measure's variable is a numeric variable.
            if (measure.Type == VariableType.Numeric)
            {
                Data data = storageMethod.GetRespondentsNumeric(
                    measure.Identity,
                    measure.IsTaxonomy,
                    this.Core.CaseDataLocation,
                    filter,
                    this.Definition.WeightingFilters
                    );

                writer.Append(data.Value.ToString(new CultureInfo("en-GB")));
                writer.Append(",");

                i++;

                if (totalToProcess != 0)
                {
                    int progress = (int)(i * 100 / totalToProcess);

                    if (progress == 100)
                    {
                        base.Progress = 99;
                    }
                    else
                    {
                        base.Progress = progress;
                    }
                }
            }
            else
            {
                filter = storageMethod.GetRespondents(measure, filter, this.Definition.WeightingFilters);
                string baseValue  = filter.Base.ToString(new CultureInfo("en-GB"));
                string uBaseValue = filter.Responses.Count.ToString(new CultureInfo("en-GB"));

                int rowOffset = i;

                // Run through all scores of the measure.
                foreach (LinkBiDefinitionDimensionScore score in measure.Scores)
                {
                    if (score.Hidden)
                    {
                        continue;
                    }

                    if (measure.IsTaxonomy && score.Persistent &&
                        base.Definition.HierarchyFilter.TaxonomyCategories.ContainsKey(score.Identity) == false)
                    {
                        continue;
                    }

                    DefinitionObject _score = new DefinitionObject(
                        this.Core,
                        this.Definition.FileName,
                        score.XmlNode.GetXPath()
                        );

                    Data scoreFilter = score.GetRespondents(filter, this.StorageMethod);

                    for (int r = 0; r < scoreFilter.Responses.Count; r++)
                    {
                        //writer.Append(selection);

                        writer.Append(_score.GetLabel(this.Definition.Settings.IdLanguage).Replace(",", "&#44;") + ",");

                        //writer.Append(Environment.NewLine);

                        break;
                    }


                    i++;

                    if (totalToProcess != 0)
                    {
                        int progress = (int)(i * 100 / totalToProcess);

                        if (progress == 100)
                        {
                            base.Progress = 99;
                        }
                        else
                        {
                            base.Progress = progress;
                        }
                    }
                }
            }
        }
        private void RenderFilter(LinkBiDefinitionDimension filter, StringBuilder writer, int offset, string selection, Data dataFilter = null)
        {
            Data scoreFilter;

            // Run through all filter scores of the filter.
            foreach (LinkBiDefinitionDimensionScore score in filter.Scores)
            {
                if (score.Hidden)
                {
                    continue;
                }

                if (filter.IsTaxonomy && score.Persistent &&
                    base.Definition.HierarchyFilter.TaxonomyCategories.ContainsKey(score.Identity) == false)
                {
                    continue;
                }

                DefinitionObject _score = new DefinitionObject(
                    this.Core,
                    this.Definition.FileName,
                    score.XmlNode.GetXPath()
                    );

                string _selection = selection + _score.GetLabel(this.Definition.Settings.IdLanguage).Replace(",", "&#44;") + ",";

                int rowOffset = i;

                scoreFilter = score.GetRespondents(dataFilter, this.StorageMethod);

                if (this.Definition.Dimensions.Count > (offset + 1))
                {
                    RenderFilter(
                        this.Definition.Dimensions[offset + 1],
                        writer,
                        offset + 1,
                        _selection,
                        scoreFilter
                        );
                }
                else
                {
                    writer.Append(_selection);

                    foreach (LinkBiDefinitionDimension measure in this.Definition.Measures)
                    {
                        RenderMeasure(
                            measure,
                            writer,
                            offset + 1,
                            _selection,
                            scoreFilter
                            );
                    }

                    writer = writer.Remove(writer.Length - 1, 1);

                    writer.Append(Environment.NewLine);
                }
            }
        }
Example #9
0
        private void RenderMeasure(LinkBiDefinitionDimension measure, StringBuilder writer, int columnOffset, string selection, Data filter = null)
        {
            DataCore.Classes.StorageMethods.Database storageMethod = new DataCore.Classes.StorageMethods.Database(
                base.Core,
                null
                );

            VariableType variableType = measure.VariableType;

            // Check if the measure's variable is a numeric variable.
            if (variableType == VariableType.Numeric)
            {
                Data data = storageMethod.GetRespondentsNumeric(
                    measure.Identity,
                    measure.IsTaxonomy,
                    this.Core.CaseDataLocation,
                    filter,
                    this.Definition.WeightingFilters
                    );

                selection += HttpUtility.HtmlEncode(measure.Label).Replace(",", "&#44;") + ",";

                writer.Append(selection);
                writer.Append(filter.Base.ToString(new CultureInfo(2057)));
                writer.Append(",");
                writer.Append(data.Value.ToString(new CultureInfo(2057)));
                writer.Append(Environment.NewLine);
            }
            else
            {
                filter = storageMethod.GetRespondents(measure, filter, this.Definition.WeightingFilters);
                string baseValue  = filter.Base.ToString(new CultureInfo("en-GB"));
                string uBaseValue = filter.Responses.Count.ToString(new CultureInfo("en-GB"));
                string eBaseValue = filter.Responses.Count.ToString(new CultureInfo("en-GB"));


                int rowOffset = i;

                selection += HttpUtility.HtmlEncode(measure.Label).Replace(",", "&#44;") + ",";

                // Run through all scores of the measure.
                foreach (LinkBiDefinitionDimensionScore score in measure.Scores)
                {
                    if (score.Hidden)
                    {
                        continue;
                    }

                    if (measure.IsTaxonomy && score.Persistent &&
                        base.Definition.HierarchyFilter.TaxonomyCategories.ContainsKey(score.Identity) == false)
                    {
                        continue;
                    }

                    DefinitionObject _score = new DefinitionObject(
                        this.Core,
                        this.Definition.FileName,
                        score.XmlNode.GetXPath()
                        );

                    writer.Append(selection);
                    writer.Append(_score.GetLabel(this.Definition.Settings.IdLanguage).Replace(",", "&#44;") + ",");

                    /*Data scoreFilter = storageMethod.GetRespondents(
                     *  score.Identity,
                     *  measure.Identity,
                     *  measure.IsTaxonomy,
                     *  filter,
                     *  this.Definition.WeightingFilters
                     * );*/
                    Data scoreFilter = score.GetRespondents(filter, this.StorageMethod);

                    if (this.DisplayUnweightedBase)
                    {
                        writer.Append(uBaseValue + ",");
                    }

                    if (this.DisplayEffectiveBase)
                    {
                        writer.Append(eBaseValue + ",");
                    }

                    writer.Append(baseValue + ",");
                    writer.Append(scoreFilter.Value);

                    if (this.ExportPercentage)
                    {
                        writer.Append(",");

                        if (filter.Base != 0)
                        {
                            writer.Append((scoreFilter.Value * 100 / filter.Base).ToString(new CultureInfo("en-GB")));
                        }
                        else
                        {
                            writer.Append("0");
                        }
                    }

                    writer.Append(Environment.NewLine);

                    i++;

                    if (totalToProcess != 0)
                    {
                        int progress = i * 100 / totalToProcess;

                        if (progress == 100)
                        {
                            base.Progress = 99;
                        }
                        else
                        {
                            base.Progress = progress;
                        }
                    }
                }
            }
        }
Example #10
0
        private void RenderDimension(LinkBiDefinitionDimension dimension, StringBuilder writer, int offset, string selection, Data dataFilter = null)
        {
            Data scoreFilter;

            // Run through all filter scores of the filter.
            foreach (LinkBiDefinitionDimensionScore score in dimension.Scores)
            {
                if (score.Hidden)
                {
                    continue;
                }

                if (dimension.IsTaxonomy && score.Persistent &&
                    base.Definition.HierarchyFilter.TaxonomyCategories.ContainsKey(score.Identity) == false)
                {
                    continue;
                }

                DefinitionObject _score = new DefinitionObject(
                    this.Core,
                    this.Definition.FileName,
                    score.XmlNode.GetXPath()
                    );

                string _selection = selection + _score.GetLabel(this.Definition.Settings.IdLanguage).Replace(",", "&#44;") + ",";

                int rowOffset = i;

                /*scoreFilter = storageMethod.GetRespondents(
                 *  score.Identity,
                 *  filter.Identity,
                 *  filter.IsTaxonomy,
                 *  dataFilter,
                 *  this.Definition.WeightingFilters
                 * );*/
                scoreFilter = score.GetRespondents(dataFilter, this.StorageMethod);

                if (this.Definition.Dimensions.Count > (offset + 1))
                {
                    RenderDimension(
                        this.Definition.Dimensions[offset + 1],
                        writer,
                        offset + 1,
                        _selection,
                        scoreFilter
                        );
                }
                else
                {
                    foreach (LinkBiDefinitionDimension measure in this.Definition.Measures)
                    {
                        RenderMeasure(
                            measure,
                            writer,
                            offset + 1,
                            _selection,
                            scoreFilter
                            );
                    }

                    //selection = "";
                }

                /*for (int a = rowOffset; a < i; a++)
                 * {
                 *  //writer.Append(score.Label + ",");
                 *  selection += score.Label + ",";
                 * }*/

                //i++;
            }
        }
        public override void Render(StringBuilder writer, HierarchyFilter hierarchyFilter)
        {
            string[] chartingColors = LoadChartingColors();
            //Random rnd = new Random();
            //List<string> usedColors = new List<string>();
            int i = 0;

            // Select the xml node that contains the chart's data.
            XmlNodeList xmlNodes = this.Document.SelectNodes(this.PathDimension + "/*[not(self::Variable)][not(self::MeanScore)]");


            // Open an array for the values.
            writer.Append("[");

            foreach (XmlNode xmlNodeCategory in xmlNodes)
            {
                if (xmlNodeCategory.Attributes["ShowInChart"] != null && bool.Parse(xmlNodeCategory.Attributes["ShowInChart"].Value) == false)
                {
                    continue;
                }

                // if (xmlNodeCategory.Name == "MeanScore") continue;
                if (xmlNodeCategory.ParentNode.Attributes["IsNestedBase"] != null && bool.Parse(xmlNodeCategory.ParentNode.Attributes["IsNestedBase"].Value) == true)
                {
                    continue;
                }

                DefinitionObject variable = new DefinitionObject(
                    base.Core,
                    this.Source,
                    string.Format(
                        "//Variable[@Id=\"{0}\"]",
                        xmlNodeCategory.ParentNode.Attributes["Id"].Value
                        )
                    );
                DefinitionObject category = new DefinitionObject(
                    base.Core,
                    this.Source,
                    string.Format(
                        "//Variable[@Id=\"{2}\"]/{0}[@Id=\"{1}\"]",
                        xmlNodeCategory.Name,
                        xmlNodeCategory.Attributes["Id"].Value,
                        xmlNodeCategory.ParentNode.Attributes["Id"].Value
                        )
                    );

                object enabled   = category.GetValue("Enabled");
                object _hasValue = category.GetValue("HasValues");

                ReportDefinition reportDefinition = new ReportDefinition(
                    base.Core,
                    this.Source,
                    hierarchyFilter
                    );

                //if (enabled != null && bool.Parse((string)enabled) == false)
                //    continue;
                bool hasValue = true;

                bool.TryParse(_hasValue != null ? _hasValue.ToString() : "true", out hasValue);

                if ((enabled != null && bool.Parse((string)enabled) == false) || (hasValue == false && reportDefinition.Settings.HideEmptyRowsAndColumns))
                {
                    continue;
                }

                string variableName  = (string)variable.GetValue("Name");
                string categoryName  = (string)category.GetValue("Name");
                string categoryLabel = (string)category.GetLabel(base.IdLanguage);
                if (String.IsNullOrEmpty(categoryName))
                {
                    categoryName = categoryLabel;
                }
                writer.Append("{");

                writer.Append(string.Format(
                                  "\"dimension\": \"{0}\", \"Label\": \"{1}\",",
                                  variableName + "_" + categoryName,
                                  categoryLabel
                                  ));

                //XmlNodeList xmlNodesMeasures = xmlNodeCategory.SelectNodes("Variable/TaxonomyCategory");
                XmlNodeList xmlNodesMeasures = xmlNodeCategory.SelectNodes(this.PathMeasure + "/*[not(self::Variable)]");

                foreach (XmlNode measure in xmlNodesMeasures)
                {
                    if (measure.Attributes["ShowInChart"] != null && bool.Parse(measure.Attributes["ShowInChart"].Value) == false)
                    {
                        continue;
                    }

                    if (measure.ParentNode.Attributes["IsNestedBase"] != null &&
                        bool.Parse(measure.ParentNode.Attributes["IsNestedBase"].Value) == true)
                    {
                        continue;
                    }

                    //usedColors.Add(measure.Attributes["Color"].Value);

                    DefinitionObject category2 = new DefinitionObject(
                        base.Core,
                        this.Source,
                        //xmlNodeCategory.GetXPath(true)
                        string.Format(
                            "//{2}[@Id=\"{3}\"]/{0}[@Id=\"{1}\"]",
                            measure.Name,
                            measure.Attributes["Id"].Value,
                            measure.ParentNode.Name,
                            measure.ParentNode.Attributes["Id"].Value
                            )
                        );

                    double value     = 0.0;
                    double baseValue = 0;

                    // Nested on the left.
                    if ((category2.XmlNode.ParentNode.Name != "ScoreGroup" && category2.XmlNode.ParentNode.Attributes["Position"] != null && category2.XmlNode.ParentNode.Attributes["Position"].Value == "Left") ||
                        (category2.XmlNode.ParentNode.Name == "ScoreGroup" && category2.XmlNode.ParentNode.ParentNode.Attributes["Position"] != null && category2.XmlNode.ParentNode.ParentNode.Attributes["Position"].Value == "Left"))
                    {
                        value     = double.Parse(measure.ParentNode.ParentNode.Attributes["Base"].Value);
                        baseValue = double.Parse(measure.ParentNode.ParentNode.ParentNode.Attributes["Base"].Value);

                        writer.Append(string.Format(
                                          "\"_{0}\": \"{1}\",",
                                          "",
                                          (value * 100 / baseValue).ToString(new CultureInfo(2057))
                                          ));

                        if (measure.ChildNodes.Count > 0)
                        {
                            writer.Append(string.Format(
                                              "\"XPATH_{0}\": \"{1}\", \"IsDimensionPath_{0}\": \"true\", \"Color_{0}\": \"{2}\"",
                                              "",
                                              HttpUtility.UrlEncode(measure.ParentNode.ParentNode.GetXPath(true) + "/Variable"),
                                              measure.Attributes["Color"].Value

                                              /*HttpUtility.UrlEncode(string.Format(
                                               *  "Variable[@Id='{0}']/{2}[@Id='{1}']/Variable",
                                               *  measure.ParentNode.Attributes["Id"].Value,
                                               *  measure.Attributes["Id"].Value,
                                               *  measure.Name
                                               * ))*/
                                              ));
                        }

                        break;
                    }

                    enabled = category2.GetValue("Enabled");
                    bool _enabled;
                    _hasValue = category2.GetValue("HasValues", false);

                    hasValue = true;

                    bool.TryParse(_hasValue != null ? _hasValue.ToString() : "true", out hasValue);

                    if (enabled != null && bool.TryParse(enabled.ToString(), out _enabled))
                    {
                        if ((_enabled == false) || (hasValue == false && reportDefinition.Settings.HideEmptyRowsAndColumns))
                        {
                            continue;
                        }
                    }

                    //if (enabled != null && bool.TryParse(enabled.ToString(), out _enabled))
                    //{
                    //    if (_enabled == false)
                    //        continue;
                    //}

                    string measureLabel = new DefinitionObject(
                        this.Core,
                        category2.Source,
                        category2.ParentPath
                        ).GetLabel(base.IdLanguage) +
                                          "###SPLIT###" + category2.GetLabel(base.IdLanguage);

                    if (category2.TypeName != "NumericValue")
                    {
                        if (measure.Attributes["Base"] != null)
                        {
                            value = double.Parse(measure.Attributes["Base"].Value);
                        }
                        else if (measure.ParentNode.Attributes["Base"] != null)
                        {
                            value = double.Parse(measure.ParentNode.Attributes["Base"].Value);
                        }

                        if (measure.Attributes["Value"] != null)
                        {
                            baseValue = value;
                            value     = double.Parse(measure.Attributes["Value"].Value);
                        }
                        else if (measure.ChildNodes.Count > 0)
                        {
                            if (measure.ChildNodes[0].Attributes["Base"] != null)
                            {
                                baseValue = double.Parse(measure.ChildNodes[0].Attributes["Base"].Value);
                            }
                        }
                        bool isFake = Guid.Parse(measure.Attributes["Id"].Value) == new Guid();

                        if (isFake)
                        {
                            baseValue = double.Parse(measure.ParentNode.Attributes["VariableBase"].Value);
                        }
                    }
                    else
                    {
                        value     = double.Parse(measure.ParentNode.ParentNode.Attributes["Base"].Value);
                        baseValue = double.Parse(measure.ParentNode.ParentNode.ParentNode.Attributes["Base"].Value);
                    }

                    if (chartingColors.Length == i)
                    {
                        i = 0;
                    }

                    writer.Append(string.Format(
                                      "\"_{0}\": \"{1}\", \"Color_{0}\": \"{2}\",",
                                      measureLabel,
                                      (value * 100 / baseValue).ToString(new CultureInfo(2057)),
                                      chartingColors[i++]//measure.Attributes["Color"].Value
                                      ));

                    if (measure.ChildNodes.Count > 0)
                    {
                        writer.Append(string.Format(
                                          "\"XPATH_{0}\": \"{1}\",",
                                          measureLabel,
                                          HttpUtility.UrlEncode(string.Format(
                                                                    "Variable[@Id='{0}']/{2}[@Id='{1}']/Variable",
                                                                    measure.ParentNode.Attributes["Id"].Value,
                                                                    measure.Attributes["Id"].Value,
                                                                    measure.Name
                                                                    ))
                                          ));
                    }
                }

                writer = writer.Remove(writer.Length - 1, 1);

                writer.Append("},");
            }

            if (xmlNodes.Count > 0)
            {
                writer = writer.Remove(writer.Length - 1, 1);
            }

            // Close the values array.
            writer.Append("]");
        }