Page 1 of 1

Loading chart data from arrays

Posted: Thu Jan 31, 2013 5:11 pm
by groo
Hello everyone!

I am trying to load data into one of my charts from two arrays (double?[] and object[]), but it's not working.

I tried something as simple as this:

Code: Select all

chart.Series.Add(new StiLineSeries()
{
    Values = new double?[] { 50.0, 50.1, 50.2 },
    Arguments =  new object[] { "1", "2", "3" }
});
The chart is shown, and the line series seems to be added (there is a "Series1" label in the legend), but there is no data at all.

I am doing this right before showing the report, i.e. the full test code looks like this:

Code: Select all

private void ShowReportButton_Click(object sender, EventArgs e)
{
    var report = LoadReportFromEmbeddedResource("Report.mrt");
    var chart = (StiChart)report.GetComponentByName("MyChart");
    chart.Series.Add(new StiLineSeries()
    {
        Values = new double?[] { 50.0, 50.1, 50.2 },
        Arguments =  new object[] { "1", "2", "3" }
    });
    report.Show(true);
}
What am I doing wrong? Thanks a lot!

(if needed: I am using Stimulsoft Reports.Net v2012.3.1500, .NET4, Windows 7 x86)

Re: Loading chart data from arrays

Posted: Fri Feb 01, 2013 2:19 pm
by HighAley
Hello.

Sorry, we need a little more time to prepare an answer for you.

Thank you.

Re: Loading chart data from arrays

Posted: Fri Feb 01, 2013 2:50 pm
by groo
Aleksey Andreyanov wrote:Sorry, we need a little more time to prepare an answer for you.
No problem, I am not in a hurry and this is not a stopping issue right now. Thanks!

Re: Loading chart data from arrays

Posted: Mon Feb 04, 2013 11:09 am
by HighAley
Hello.

It's impossible to set Values and Arguments such way.
Look at the attached sample project how to create chart at runtime.

Thank you.

Re: Loading chart data from arrays

Posted: Wed Feb 27, 2013 3:33 pm
by groo
Hi, thanks for the answer, it took me some time to get back to this, and now that I've tried it, I have one more tiny problem:

The series name in the legend is shown as "Series 1" (in the example you attached).

It looks like this line should be setting it:

Code: Select all

Item.TitleValue = "Chart in Run Time"; // Item is StiClusteredColumnSeries
I have also tried to handle the GetTitle event:

Code: Select all

Item.GetTitle += (s, e) => e.Value = "Chart in Run Time";
but the chart legend always displays "Series 1".

What could be the problem?

Re: Loading chart data from arrays

Posted: Thu Feb 28, 2013 1:17 pm
by HighAley
Hello.

Please, use next code to set title:

Code: Select all

Item.CoreTitle = "Chart in Run Time";
Thank you.