Пример #1
0
        private static void AddSnapshotToSlide(ISlide slide, string name, string snapshotId, string region, string left)
        {
            int selectedIndex = 0;
            var prop          = slide.CreateSnapshotSlideItemProperties(name, snapshotId);

            prop.Position = new SlidePosition
            {
                Height = "33%",
                Left   = left,
                Top    = "25%",
                Width  = "33%",
                ZIndex = 1
            };
            var slideItem = slide.CreateSlideItem(name, prop);

            slideItem.EmbedSnapshotObject(snapshotId);
            var mySnapShotedItem = slideItem.GetSnapshotObject();

            var data = mySnapShotedItem.GetProperties();

            if (region != null)
            {
                var hypercube = data.Get <HyperCube>("qHyperCube");
                foreach (var nxDataPage in hypercube.DataPages)
                {
                    int index = -1;
                    foreach (var cellRows in nxDataPage.Matrix)
                    {
                        index++;
                        foreach (var row in cellRows)
                        {
                            if (row.Text == region)
                            {
                                selectedIndex = index;
                            }
                        }
                    }
                }
            }
            using (mySnapShotedItem.SuspendedLayout)
            {
                JObject originalModelSettings = new JObject();
                JObject datapoint             = new JObject();
                JObject legend = new JObject();
                datapoint.Add("auto", false);
                datapoint.Add("labelmode", "share");
                legend.Add("show", false);
                legend.Add("dock", "auto");
                legend.Add("showTitle", true);
                originalModelSettings.Add("dataPoint", datapoint);
                originalModelSettings.Add("legend", legend);
                originalModelSettings.Add("dimensionTitle", true);
                data.Set("originalModelSettings", originalModelSettings);
                if (region != null)
                {
                    data.Set("effectPath", "/effects/highlight-value");
                    JObject effectProperties = new JObject();
                    effectProperties.Add("selectedIndex", selectedIndex);

                    data.Set("effectProperties", effectProperties);
                }
            }
        }