Query |
Answer | |
I am creating charts and instead of having it say series 1, series 2, series 3, series 4, etc. in the legend how do I get the actual value from the query in there? |
While creating the chart , the data range should include the series names. Otherwise, the chart will show default series names. You can set the includeheader parameter value as true in the importData method to give series names for the data .
Code Snippet:
| |
How do I get the chart with the value showing? |
You can use IChartDataLabels.IsValue property to show the series values in the chart. Please refer the following code sample for the same.
Code Snippet:
|
It displays names but instead of the name of the column, it is displaying the name of the parameters in my method. Is there a way around this?
I have included the methods for data access in the DAL.cs file, my stored procedure in the databaseProcedures.sql file, the results of the procedure (PivotedDemographicGroupAverage) used in the PivotedDemographics method as "results of query.xlsx", the controller code, and a copy of the latest excel file generated by the PivotedDemographics method
Thank you with a bit of modification I was able to use your code.
My solution
Since these are dynamic I needed something that would fill them in at run time instead of design time. So what I did was create a list with the values and then did a foreach loop to populate the text for the legend.
GetDemographicResponses gdr = new GetDemographicResponses();
gdr.Demographic = Demographic;
List<GetDemographicResponses_Result> DR = gdr.DemographicResponses();
int z = 1;
Then whenever I am displaying a chart and I want the legend to display the actual value I did the following.
sheet0[3, 1].Text = "Questions";
foreach(var x in DR)
{
sheet0[3, (z + x.Sequence)].Text = x.ResponseText;
}