private void PopulateBubbleChartInputsWithInitialValues(SPList list)
        {
            foreach (SPField selectedListField in list.Fields)
            {
                if (selectedListField.Type == SPFieldType.Choice)
                {
                    var colorFieldListItem = new ListItem(selectedListField.Title,
                                                          selectedListField.InternalName);
                    BubbleChartZcolorFieldDropDownList.Items.Add(colorFieldListItem);
                }

                if (selectedListField.Type == SPFieldType.Attachments ||
                    selectedListField.InternalName == "Order" ||
                    selectedListField.Type == SPFieldType.File || selectedListField.InternalName == "MetaInfo" ||
                    selectedListField.Type == SPFieldType.Computed ||
                    (selectedListField.FromBaseType &&
                     (!selectedListField.FromBaseType || selectedListField.InternalName != "Title")))
                {
                    continue;
                }

                //TODO: Consolidate these if the X axis will only ever be a number.
                var xAxisListItem = new ListItem(selectedListField.Title, selectedListField.InternalName);
                var zAxisListItem = new ListItem(selectedListField.Title, selectedListField.InternalName);

                if (ChartHelper.IsCalculateableSharepointField(selectedListField))
                {
                    BubbleChartXaxisDropDownList.Items.Add(xAxisListItem);
                    BubbleChartZaxisDropDownList.Items.Add(zAxisListItem);
                }

                if (selectedListField.TypeAsString != "Currency" && selectedListField.TypeAsString != "Number" &&
                    (selectedListField.Type != SPFieldType.Calculated ||
                     EpmChart.GetFieldSchemaAttribValue(selectedListField.SchemaXml, "ResultType") != "Number") &&
                    (selectedListField.Type != SPFieldType.Calculated ||
                     EpmChart.GetFieldSchemaAttribValue(selectedListField.SchemaXml, "ResultType") != "Currency"))
                {
                    continue;
                }

                var yAxisListItem = new ListItem(selectedListField.Title, selectedListField.InternalName);
                if (!IsBubbleChart())
                {
                    BubbleChartYaxisCheckBoxList.Items.Add(yAxisListItem);
                }
                else
                {
                    BubbleChartYaxisAsDropDownList.Items.Add(yAxisListItem);
                }
            }

            SortBubbleChartDropDownLists();
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DisablePageCaching();

            var trace = false;

            if (Request["Trace"] != null)
            {
                trace = true;
            }

            var chart = new EpmChart(Request);

            chart.DataBindChart();

            Response.Clear();

            if (trace)
            {
                Response.Write(chart.TraceOutput);
            }

            Response.Write(chart.GetXaml());
        }
        private void FillDropdowns(SPList oList)
        {
            if (!IsBubbleChart())
            {
                ZaxisFieldDropDownList.Items.Add("-- None Selected --");
            }

            foreach (SPField fld in oList.Fields)
            {
                if (fld.Type == SPFieldType.Choice)
                {
                    var colorFieldListItem = new ListItem(fld.Title, fld.InternalName);
                    BubbleChartColorFieldDropDownList.Items.Add(colorFieldListItem);
                }

                if (fld.Type == SPFieldType.Attachments || fld.InternalName == "Order" ||
                    fld.Type == SPFieldType.File || fld.InternalName == "MetaInfo" ||
                    fld.Type == SPFieldType.Computed ||
                    (fld.FromBaseType && (!fld.FromBaseType || fld.InternalName != "Title")))
                {
                    continue;
                }

                var liX = new ListItem(fld.Title, fld.InternalName);

                if (!IsBubbleChart() || (IsBubbleChart() && ChartHelper.IsCalculateableSharepointField(fld)))
                {
                    XaxisFieldDropDownList.Items.Add(liX);
                }


                var liZ = new ListItem(fld.Title, fld.InternalName);

                if (IsBubbleChart())
                {
                    if (ChartHelper.IsCalculateableSharepointField(fld))
                    {
                        ZaxisFieldDropDownList.Items.Add(liZ);
                    }
                }
                else
                {
                    ZaxisFieldDropDownList.Items.Add(liZ);
                }

                if (fld.TypeAsString != "Currency" && fld.TypeAsString != "Number" &&
                    (fld.Type != SPFieldType.Calculated ||
                     EpmChart.GetFieldSchemaAttribValue(fld.SchemaXml, "ResultType") != "Number") &&
                    (fld.Type != SPFieldType.Calculated ||
                     EpmChart.GetFieldSchemaAttribValue(fld.SchemaXml, "ResultType") != "Currency"))
                {
                    continue;
                }

                var liY = new ListItem(fld.Title, fld.InternalName);
                YaxisFieldCheckBoxList.Items.Add(liY);
                YaxisFieldAsDropDownList.Items.Add(liY);
            }

            foreach (SPView vw in oList.Views)
            {
                ViewsDropDownList.Items.Add(vw.Title);
            }

            SortDropDownList(ViewsDropDownList);
            SortDropDownList(XaxisFieldDropDownList);
            SortDropDownList(YaxisFieldAsDropDownList);
            SortDropDownList(ZaxisFieldDropDownList);
            SortDropDownList(BubbleChartColorFieldDropDownList);
        }