Profile Picture

Trouble creating a stacked area chart

Posted By Bob Smith 7 Years Ago
Author
Message
Bob Smith
Posted 7 Years Ago
View Quick Profile
Forum Guru

Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 69, Visits: 1
I am trying to create a stacked area chart using the sample data that is attached to this thread.

Please look at the attached NCSP file (rename the extension from GIF to NCSP) for particular details about my configuration. The sample data is attached but the extension has been changed from xlsx to gif. Place the sample data in the same web with a list name of "Work_Percentage_List_Test".

I am trying to stack the areas on top of one another and create a chart that indicates cumulative workload for an individual over time. Instead of stacking, my series end up next to one another on the chart (across the X axis [see example image]).

I also tried sorting the date category by using the expression "=DATETIME(Fields!Start_Date_Enum)" and the graph that showed up from that was even crazier...

There must be a simple fix to this!

Nevron Support
Posted 7 Years Ago
View Quick Profile
Supreme Being

Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 2,888, Visits: 3,074

Hello Bob,

It looks like your attachments are missing from this post. Try adding them again.

 

Regarding the Stacked Area  Chart – have you selected the chart Sub Type: Stacked ?

Best Regards,
Nevron Support Team



Bob Smith
Posted 7 Years Ago
View Quick Profile
Forum Guru

Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 69, Visits: 1
Very odd... I've attached them here.

Attachments
Stacked_Area_NCSP.GIF (179 views, 9.00 KB)
Work_Percentage_List_Test_xlsx.gif (194 views, 11.00 KB)
Stacked_Actual_wrong.GIF (188 views, 12.00 KB)
Nevron Support
Posted 7 Years Ago
View Quick Profile
Supreme Being

Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 2,888, Visits: 3,074

Bob,
The problem is with the data you are passing to the chart. Because you have Category grouping by Date (start date) and Series grouping by Project, this results in a chart with multiple empty data points. This is why the Stacked Area chart looks incorrect. In other words, the Area series are not stacked because you don’t have data for the different projects for the same Date.

To get a better understanding of this, simply switch the chart type to Bar and/or Line (sub type Stacked). This will provide a better view of the result that is coming from your data.



Best Regards,
Nevron Support Team



Bob Smith
Posted 7 Years Ago
View Quick Profile
Forum Guru

Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 69, Visits: 1

Ok, I configured the X Axis as specified in the last post of this thread:

http://forum.nevron.com/shwmessage.aspx?ForumID=13&MessageID=7362

I changed the chart type to XY Scatter Stacked Area and set the X value in the pivot settings as the date (see the last post in the referenced thread). The attached screenshot displays the issue I am now experiencing.

I've attached both the image and an updates NCSP file (change the file extension from GIF to NCSP). This connects to the same data as the example above.



Attachments
XY_Scatter_Stacked_Area.gif (186 views, 18.00 KB)
Stacked_Area_Chart_2_ncsp.gif (181 views, 10.00 KB)
Bob Smith
Posted 7 Years Ago
View Quick Profile
Forum Guru

Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 69, Visits: 1

It seems that I would have to have data points for each month then, on the same exact datetimes for each series in order for the data to stack? I could use workflow to generate those intervening points if I had to...



Bob Smith
Posted 7 Years Ago
View Quick Profile
Forum Guru

Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 69, Visits: 1

Ok,

I've made my sample data set more robust and set up data labels on the area chart.

How can I put the cumulative value for all the series in the data label? I know there is a way to override the default scope of the current data set. I've attached a screenshot, an updated NCSP file and the new sample data set.



Attachments
Nevron Support
Posted 7 Years Ago
View Quick Profile
Supreme Being

Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)Supreme Being (3,954 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 2,888, Visits: 3,074

Hi Bob,

For this requirement you will need to set the Data Label Style Format to: <cumulative>

Attached you can find the modified template file and here is the result:

SharePoint Stacked Area Chart

 

The following custom code shows how you can achieve this:

 

using System;

using System.Drawing;

using Nevron.GraphicsCore;

using Nevron.Chart;

using Nevron.ReportingServices;

 

namespace MyNamespace

{

    ///

    /// Sample class

    ///

    public class MyClass

    {

        ///

        /// Main entry point

        ///

        ///

        public static void RSMain(NRSChartCodeContext context)

        {

            if (context.Document.Charts.Count == 0)

                return;

 

            // get the first chart in the document

            NChart chart = context.Document.Charts[0];

 

            if (chart.Series.Count == 0)

                return;

 

            // get the first Area series in the chart

            NSeries series0 = chart.Series[0] as NSeries;

            if (series0 == null)

                return;

 

            // get the second Area series in the chart

            NSeries series1 = chart.Series[1] as NSeries;

            if (series1 == null)

                return;

 

            // get the third Area series in the chart

            NSeries series2 = chart.Series[2] as NSeries;

            if (series2 == null)

                return;

 

            series0.DataLabelStyle.Format = "<value>";

            series1.DataLabelStyle.Format = "<cumulative>";

            series2.DataLabelStyle.Format = "<cumulative>";

 

        }

    }

}

Best Regards,
Nevron Support Team



Attachments
SharePoint-Stacked-Area-Chart.ncsp (192 views, 39.00 KB)
Bob Smith
Posted 7 Years Ago
View Quick Profile
Forum Guru

Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)

Group: Forum Members
Last Active: 7 Years Ago
Posts: 69, Visits: 1

Thanks for this answer! This helped in getting me started.

I made a revision to the "cumulative" series code as each user had a different number of series and I needed it to be dynamic. I don't know how to tag it as custom code on the forums here...

using System;
using System.Drawing;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.ReportingServices;
 
namespace MyNamespace
{
    ///
    /// Sample class
    ///
    public class MyClass
    {
        ///
        /// Main entry point
        ///
        ///
        public static void RSMain(NRSChartCodeContext context)
        {
            if (context.Document.Charts.Count == 0)
                return;
            
            // get the first chart in the document
            NChart chart = context.Document.Charts[0];
            //chart.Series[0].InflateMargins = false;
            
            if (chart.Series.Count == 0)
                return;
    
           int count = chart.Series.Count;
           for (int i = 1; i < count; i++)
           {
               NSeries CurrentSeries = chart.Series[i] as NSeries;
               CurrentSeries.DataLabelStyle.Format = "<cumulative>";
           }
        }
    }
}





Similar Topics


Reading This Topic