Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4110
Need a sample for a basic Scatter chart
posted

Does anyone have some sample code for a simple scatter-line chart? I have done many of the 2D charts, but haven't done the scatter chart yet. I've seen one example of a scatter-line chart and can't get it to display. Any help would be greatly appreciated. My Y axis is min 0 & max 50 with a single increment of 25. My X Axis is Planets, with the various planets plotted on the chart (assigned values between 5 and 45). I get no errors, but I can't get it to display.

Parents Reply Children
  • 8607
    Offline posted in reply to Daryl

    Hello dbishop9,

    It's me again. :) 

    I followed the "getting started" topic in the help to come up with this code behind for creating the data (just as an example).

            protected void Page_Load(object sender, EventArgs e)
            {
                this.UltraChart1.DataSource = GetColumnData();
                this.UltraChart1.DataBind();
            }

            private DataTable GetColumnData()
            {
                DataTable mydata = new DataTable();

                mydata.Columns.Add("Series Labels", typeof(string));
                mydata.Columns.Add("XValue", typeof(int));
                mydata.Columns.Add("YValue", typeof(int));

                mydata.Rows.Add(new Object[] { "Mercury", 5, 20 });
                mydata.Rows.Add(new Object[] { "Venus", 10, 20 });
                mydata.Rows.Add(new Object[] { "Earth", 15, 20 });
                mydata.Rows.Add(new Object[] { "Mars", 20, 20 });

                return mydata;
            }

    Then I did what Swetha suggested.  I set the Column value differently each time, but I'm not sure that it matters.  Setting the Visible property on each item might be the key.  Here's how it appeared in the .aspx page.

                <ChartText>
                    <igchartprop:ChartTextAppearance ChartTextFont="Arial, 7pt" Column="0"
                        ItemFormatString="Mercury" Row="0" Visible="True" />
                    <igchartprop:ChartTextAppearance ChartTextFont="Arial, 7pt" Column="10"
                        ItemFormatString="Venus" Row="1" Visible="True" />
                    <igchartprop:ChartTextAppearance ChartTextFont="Arial, 7pt" Column="15"
                        ItemFormatString="Earth" Row="2" Visible="True" />
                    <igchartprop:ChartTextAppearance ChartTextFont="Arial, 7pt" Column="20"
                        ItemFormatString="Mars" Row="3" Visible="True" />
                </ChartText>

    I hope that information helps you with setting it in the code behind.

    I have attached a screenshot.  I can upload my sample project if you'd like, but I simply explored the designer and property windows.


    Elizabeth Albert
    Localization Engineer