Jump to content
Software FX Community

Line Chart in Staked Chart


Recommended Posts


I am trying to get a line chart onto stacked chart and am struggling.

I am using the cross data provider to group some data together.

This is what I have so far:

I have created a SQLDatasource linked to my stored procedure.

I am using the code below to create my stacked chart (which works fine):

{   if (!Page.IsPostBack) {   Chart1.DataSourceSettings.Fields.Add(new FieldMap("Num_Deals", FieldUsage.Value));   Chart1.DataSourceSettings.Fields.Add(new FieldMap("BuyoutExitType", FieldUsage.ColumnHeading));   Chart1.DataSourceSettings.Fields.Add(new FieldMap("Heading", FieldUsage.RowHeading));   }     td.Font = new Font("Arial", 8, FontStyle.Bold);   td.TextColor = Color.FromArgb(4, 115, 145);   Chart1.Titles.Clear();   td.Text = "PE-backed Exits by Exit Type: Q1 2008-present";   Chart1.Titles.Add(td);     // THIS IS THE BAR CHART (Num_Deals)   Chart1.AllSeries.Gallery = Gallery.Bar;   Chart1.AllSeries.Stacked = Stacked.Normal;   Chart1.Series(0).AxisY.Title.Text = "Number of Deals";     Chart1.LegendBox.Dock = DockArea.Bottom;     Chart1.DataSourceID = "SqlDataSource1";}

Chart Code:

<chartfx7:Chart ID="Chart1" runat="server" Height="500" Width="700" ContextMenus="false">   <SpecialObjects>     <chartfx.webforms.dataproviders.crosstabdataprovider assemblyname="ChartFX.WebForms.Data">     </chartfx.webforms.dataproviders.crosstabdataprovider>   </SpecialObjects></chartfx7:Chart>

How do I get a line graph in here as well. I tried adding my database field (which I wish to chart as a line) as a new field map but then chart fx seems to chart that as a stacked chart rather than creating a new line chart.

I am at my wits end here so any help would be great



Link to comment
Share on other sites

Because you are using crosstab, the number of series will be dependant on your data.

You want to add a line to this chart, but where is the data form the line comming from? The same cross-tab?

If the data is comming from somewhere else, waht you need to do is let Chart FX do its crosstab magic and after the data is read (you can call chart.DataSourceSettings.ReadData to force a read), then you can add one more series to the chart and use the data API to set the values to this new series (last).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...