Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5849195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:57:55+00:00 2026-05-22T12:57:55+00:00

The Mission: Apply a generic template to chart series. My Template File: <Chart BackColor=211,

  • 0

The Mission: Apply a generic template to chart series.

My Template File:

<Chart BackColor="211, 223, 240" Width="250" Height="100" BackGradientStyle="TopBottom" BackSecondaryColor="Blue" BorderColor="26, 59, 105" BorderWidth="2">
  <Series>
    <series _Template_="All" Color="Black" BorderColor="180, 26, 59, 105">
    </series>
  </Series>
</Chart>

The styles applied to “Chart” work just fine. However, nothing applied to the Series template works; it merely contains the default styling.

My function that returns the chart image:

    private FileContentResult ImageCall(string config)
    {
        System.Web.UI.DataVisualization.Charting.Chart chart = new System.Web.UI.DataVisualization.Charting.Chart();


        if (config.Length > 0)
        {
            chart.Serializer.IsTemplateMode = true;
            chart.Serializer.IsResetWhenLoading = false;
            chart.Serializer.SerializableContent = "*.*";
            chart.Serializer.Load(config);
        }

        Series s2 = new Series("Series1");
        s2.ChartArea = "Area1";
        s2.ChartType = SeriesChartType.Column;
        s2.Points.Add(new DataPoint
        {
            AxisLabel = "Value1",
            YValues = new double[] { 1 }
        });
        s2.Points.Add(new DataPoint
        {
            AxisLabel = "Value2",
            YValues = new double[] { 2 }
        });
        chart.Series.Add(s2);

        ChartArea ca1 = new ChartArea("Area1");
        chart.ChartAreas.Add(ca1);

        using (var ms = new MemoryStream())
        {
            chart.SaveImage(ms, ChartImageFormat.Png);
            ms.Seek(0, SeekOrigin.Begin);

            return File(ms.ToArray(), "image/png", "mychart.png");
        }
    }

Here’s what it looks like (crappy, I know… it’s merely illustrative):

chart

Note that the bars are unstyled while the chart seems to style just fine.

The documentation regarding built-in .NET charting is woefully thin. Can anyone help me get my generic templates to work? There’s a big green check mark in it for you!

I’m probably missing something obvious. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:57:56+00:00Added an answer on May 22, 2026 at 12:57 pm

    Sigh

    So the fix, like I thought, was simple. Let the world know that templates can only be applied to object on the chart after they are added to the chart. You cannot pre-set the styles then add the series, you need to add the series then set the style.

    Here’s the updated code:

    private FileContentResult ImageCall(string config)
    {
        System.Web.UI.DataVisualization.Charting.Chart chart = new System.Web.UI.DataVisualization.Charting.Chart();
    
    
    
        Series s2 = new Series("Series1");
        s2.ChartArea = "Area1";
        s2.ChartType = SeriesChartType.Column;
        s2.Points.Add(new DataPoint
        {
            AxisLabel = "Value1",
            YValues = new double[] { 1 }
        });
        s2.Points.Add(new DataPoint
        {
            AxisLabel = "Value2",
            YValues = new double[] { 2 }
        });
        chart.Series.Add(s2);
    
        ChartArea ca1 = new ChartArea("Area1");
        chart.ChartAreas.Add(ca1);
    
                //REPOSITIONED
        if (config.Length > 0)
        {
            chart.Serializer.IsTemplateMode = true;
            chart.Serializer.IsResetWhenLoading = false;
            chart.Serializer.SerializableContent = "*.*";
            chart.Serializer.Load(config);
        }
    
        using (var ms = new MemoryStream())
        {
            chart.SaveImage(ms, ChartImageFormat.Png);
            ms.Seek(0, SeekOrigin.Begin);
    
            return File(ms.ToArray(), "image/png", "mychart.png");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my router.php file I added this code. $route['mission'] = content/index/mission; Here as you
My mission is to create a little app where you can upload a picture,
I am an eighth grader on a mission to create an application in Java
I need some comparing and replacing code in PHP Our mission is to empower
Let's say that I create a Sub (not a function) whose mission in life
In a past interview, I was asked how would I write a mission critical
This is a very basic question. I'm just on my mission to learn ASP.NET
My mission is to press a keyboard sequence, such as Ctrl + Shift +
I have the mission to make a small game for a school project. Pictures
On a continued mission to clean up the codebase I inherited, via stylecop and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.