Line Chart x,y axis from two columns

11 posts, 0 answers
  1. Sree
    Sree avatar
    30 posts
    Member since:
    Dec 2012

    Posted 16 Jan 2013 Link to this post

    Hello Team
    i have a table with 2 columns  
    FieldName       FieldValue
                                                    
    AD 12.01
    AD 13.01
    AD 14.01
    AD 15.01
    BD 23.01
    BD 24.01
    BD 25.01
    BD 26.01
    CD 27.01
    CD 28.01
    CD 29.01
    CD 30.01
    DD 27.01
    DD 28.01
    DD 29.01
    DD 30.01
    Main 10
    Main 20
    Main 30
    Main 40


    from the above table i need to create  a pivot table structure like

    MAIN AD BD CD DD
    10 23.01 27.01 27.01 12.01
    20 24.01 28.01 28.01 13.01
    30 25.01 29.01 29.01 14.01
    40 26.01 30.01 30.01 15.01

    and from here i need to generate a line chart with series MAIN vs AD
                                                                                              MAIN vs BD
                                                                                              BD     vs CD
                                                                                              AD     vs  DD

    all the data values are in double datatype

    there are some thousands of records in the table more than 100,000 records

    i dont want to create a for loop for each series addind and (x,y) insertion to it

    is there any possibility to add datacolumns as x,y axis in line chart from datatble,????

    for example for the above example X axis is MAIN column and Y-Axis is AD column for series-1
    something like fastest way, of binding datacolumns to chart Axes

    Please suggest

     

  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 21 Jan 2013 Link to this post

    Hello Sree,

    Presently we do not provide a tool that could help in this scenario. You should process all the data manually and then give the final result to RadChartView. Please note that you may experience performance issues wen loading such a large amount of data in RadChartView. In future we plan to extend the functionality of RadChartView by adding interpolation, which will allow us to handle large amounts of data without issues.

    If you have other questions, do not hesitate to ask.
     
    Kind regards,
    Jack
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Sree
    Sree avatar
    30 posts
    Member since:
    Dec 2012

    Posted 21 Jan 2013 Link to this post

    Hello Jack,
    Which means there is no possibility of binding table columns to axis of chart ? ,

    but there is an option in telerik chart,

       chart1.Series[0].DataXColumn, what this means similarly we can add y also, is the same i asked for binding datacolumn right????
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 21 Jan 2013 Link to this post

    Hi Sree,

    Yes, RadChartView can bind to a data table and show x,y value correctly. To do this you should create a LineSeries and set its ValueMember and CategoryMember properties. Here is a sample:
    RadChartView chart = new RadChartView();
    chart.Location = new Point(50, 50);
    chart.Size = new Size(400, 400);
    this.Controls.Add(chart);
     
    DataTable table = new DataTable();
    table.Columns.Add("x", typeof(int));
    table.Columns.Add("y", typeof(int));
     
    table.Rows.Add(1, 10);
    table.Rows.Add(2, 50);
    table.Rows.Add(3, 30);
    table.Rows.Add(4, 20);
    table.Rows.Add(5, 87);
     
    LineSeries lineSerie = new LineSeries();
    chart.Series.Add(lineSerie);
    lineSerie.ValueMember = "y";
    lineSerie.CategoryMember = "x";
     
    chart.DataSource = table;

    Find further details in our online documentation.

    Please note that DataXColumn is a property of RadChart control. We discontinued this control when we presented the new RadChartView control in 2012. The following table compares both controls.

    In my previous post I wanted to say that you should prepare the final table manually because we do not provide a separate data analysis tool that can produce such results. 

    I hope this answers your question. I will be glad to help If you need further assistance. 

    All the best,
    Jack
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
  6. Sree
    Sree avatar
    30 posts
    Member since:
    Dec 2012

    Posted 22 Jan 2013 Link to this post

    Hello Jack,

    Thanks for the reply, it is really helpful , but i need to plot scatteredLine series, i searched in the forums
    i got the info like telerik is not supporting scatteredline charts, i need this very urgent, is there other possibilities

    i am new to charting, please suggest me the type of graph which looks like below image



    this is a scattered line chart in Excel, the same i need to replicate in C# using telerik, initially i thought its line chart with appearance as dot or dash but not?? please suggest
  7. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 23 Jan 2013 Link to this post

    Hello Sree,

    Your assumption is correct. Currently, RadChartView does not support scattered line chart. This feature is logged in our issue tracking system and we will implement it in one of our upcoming releases. You can vote for it by using the following link.

    Scattered line chart is available in our WPF chart. You can consider hosting the WPF chart control inside your application.

    Regards,
    Jack
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
  8. Sree
    Sree avatar
    30 posts
    Member since:
    Dec 2012

    Posted 23 Jan 2013 Link to this post

    Hello Jack,

    I am doing this in telerik report chart, i am not using radchart.

    so there is no chance of using WPF chart in winforms,

    Unfortunately, i need scattered line charts in my solution by March, as in March my projecting going live
    i bought telerik only for reporting, but it is not supporting scattered line chars ,quite disappointment to me

    i dont know how to proceed
  9. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 24 Jan 2013 Link to this post

    Hello,

    You're not bound to use our RadChart item, you can create the desired chart with any product you like working with, save it as an image and display it in the report with the help of the PictureBox item. You can find a sample implementation in the following code library: Use asp:chart in Telerik Reports.

    On a side note we're currently working on a new chart item that would allow you to create scattered line charts. We would release a beta version of it in the Q1 2013 release in min February.

    Regards,
    Steve
    the Telerik team

    HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

  10. Sree
    Sree avatar
    30 posts
    Member since:
    Dec 2012

    Posted 24 Jan 2013 Link to this post



     
    Hi Jack,

    I need a  help, i am plotting a line chart using radchartview with the following table values
    Depth Pressure Density
    465 1.05 1.036
    938 1.04 1.036
    2384 1.03 1.036
    2675 1.03 1.036
    2928 1.03 1.036
    3168 1.03 1.036
    3663 1.03 1.036
    3690 1.04 1.036
    3824 1.04 1.036
    3861 1.07 1.036
    3901 1.08 1.036
    3939 1.1 1.036
    3982 1.15 1.037
    4040 1.21 1.04
    4223 1.28 1.044
    4382 1.27 1.046
    4478 1.27 1.045
    4715 1.24 1.045
    4913 1.05 1.044
    5010 1.05 1.044
    5043 1.08 1.044
    5060 1.05 1.043
    5075 1.05 1.043
    5087 1.05 1.043
    5111 1.05 1.042
    5111 1.1 1.042
    5140 1.1 1.042
    5168 1.09 1.042
    5274 1.05 1.042
    5529 1.05 1.042
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.041
    1.04
    1.04
    1.039
    1.039
    1.039
    1.039
    1.039
    1.039
    1.039
    1.039
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    1.04
    i am making values of depth and pressure =0 when found null
    my code is
     CategoricalAxis categoricalAxis = new CategoricalAxis();
     radChartview.Axes.Add(categoricalAxis);
     LinearAxis verticalAxis = new LinearAxis();
                        verticalAxis.MajorStep = 250;
                        verticalAxis.Maximum = 4900;
                        verticalAxis.Minimum = 3900;
     radChartview.Axes.Add(verticalAxis );
     LineSeries chartSeries = new LineSeries();
     string sSql = "Select Depth,Pressure from t_Fields ";
     dT = oclsCon.ExecuteQueryForDataTable(sSql);

    // Now my table have the above given values

     chartSeries.Name = "Predicted pore pressure(EMW)-low";

    chartSeries.DataSource = dT;
                            chartSeries.ValueMember = "Depth";
                            chartSeries.CategoryMember = "pressure";
                            chartSeries.ShowLabels = false;


     chartSeries.Name = "Predicted Density (EMW)-low";

    chartSeries.DataSource = dT;
                            chartSeries.ValueMember = "Depth";
                            chartSeries.CategoryMember = "Density";
                            chartSeries.ShowLabels = false;
                            radChartview.Series.Add(chartSeries);
                            radChartview.Series.Add(chartSeries1);

    I am not getting the chat axes in a proper way, i mean Y-Axis its not adjusting to the given minimum and maximum values, also somethng wrong with the zero values in the chart,

    also if i plot with only first series the graph is perfect, and when added second series, its not plotting properly, i need to disable the autoscaling in radchartview, how


    2. i asked about the negative y-Axis they suggested to use itembound property , suggested in one of the reply, but radchartview doesnt having event for ItemDataBound, please suggest how to achieve reverse y-axis

    Subscribe for ItemDataBound event of the chart and then make series items' YValue negative like this:

    void myRadChart_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)
        {
            e.SeriesItem.YValue = -e.SeriesItem.YValue;
        }

  11. Sree
    Sree avatar
    30 posts
    Member since:
    Dec 2012

    Posted 25 Jan 2013 Link to this post

    Hello Jack,
    You told that in the beta version of it in the Q1 2013 release ,( which will release in min February.) will provide scattered line charts for radchartview, this also applies to reportchart, or not

    please add the similar functionality to reportchart as well, also i didnt get proper reply for reverse- y axis in radchartview
    please help me how to make the y-Axis as reverse in radchartview,

    Also radchartview not considering null values, please make sure this feature to be included in the Q1 2013

    Thank you
  12. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 29 Jan 2013 Link to this post

    Hi Sree,

    Like Steve said, the reporting chart will add support for scattered line chart in its next beta release. This does not apply for RadChartView for WinForms and currently we cannot guarantee that our upcoming release will contain a scattered line chart. Please note that these are two different products and you should direct all questions regarding the reporting chart in the appropriate forum.

    Yes there is no ItemDataBound event in RadChartView. Instead you should iterate and modify all points after binding the chart. Here is a sample:

    foreach (CategoricalDataPoint pt in series.DataPoints)
    {
        pt.Value = -pt.Value;
    }

    Regarding your third question, I logged the null value support as a feature request and we will consider implementing it in a future version. Again, I cannot confirm that this feature will be implemented in our upcoming release. Use the following link to track the issue status. I updated your Telerik points accordingly.

    Kind regards,
    Jack
    the Telerik team

    HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

Back to Top
UI for WinForms is Visual Studio 2017 Ready