Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library

Chart.GetFromCache Method

Retrieves the specified chart from the cache.

Namespace:  System.Web.Helpers
Assembly:  System.Web.Helpers (in System.Web.Helpers.dll)

public static Chart GetFromCache(
	string key


Type: System.String
The ID of the cache item that contains the chart to retrieve. The key is set when you call the SaveToCache method.

Return Value

Type: System.Web.Helpers.Chart
The chart.

The following example shows how to retrieve the chart from the cache by using the GetFromCache method.

    var chartKey = Request["key"]; 
    if (chartKey != null) { 
        var cachedChart = Chart.GetFromCache(key: chartKey); 
        if (cachedChart == null) { 
            cachedChart = new Chart(600, 400); 
            cachedChart.AddTitle("Cached Chart -- Cached at " + DateTime.Now); 
               name: "Employee", 
               axisLabel: "Name", 
               xValue: new[] { "Peter", "Andrew", "Julie", "Mary", "Dave" }, 
               yValues: new[] { "2", "6", "4", "5", "3" }); 
            cachedChart.SaveToCache(key: chartKey,  
               minutesToCache: 2,  
               slidingExpiration: false); 

  • Medium trust for the immediate caller. This member can be used by partially trusted code.
© 2015 Microsoft