[to] the imagelocation attribute meaning of the MSChart component in. NET 3.5

Source: Internet
Author: User
Tags file url

In a. NET program/web site, if you want to generate statistical charts/graphs, you can previously use OWC (Office Web components), such as the OfficeXP component OWC10, Office2003 component OWC11. OWC uses the Com-dll method of the calling interface, but the main drawback is that the resulting picture is not beautiful enough "modern".


Now, with the release of. NET 3.5, it has introduced a new MSChart component, which, of course, has been thorough. Net of the.

First, to use this new graphics component, the. NET 3.5 SP1 environment is required.
Download and install the following files, respectively, component installation package, Chinese language pack, vs plugin.
MSChart.exe
Mschartlp_chs.exe
Mschart_visualstudioaddon.exe
There are official documents, but they are now in English.

Second, to get to the point, now to understand the meaning of the imagelocation attribute.
Chart.imagelocation
Namespace: System.Web.UI.DataVisualization.Charting
Assembly: System.Web.DataVisualization (System.web.datavisualization.dll)
In VS2008, the default value is: Chartpic_#seq (300,3)
This seems to be not very good to understand AH: (
Well, let's look at some of the correlation properties.

1, Chart.rendertype
This property determines how the graph generated by MSChart is sent to the client in three ways:
Imagetag, the graph is saved as a temporary file on the server and the URL of the temporary file as the SRC attribute value of the tag in the HTML. The URL rules for this temporary file and how the temporary files are generated can be determined by the ImageLocation property.
binarystreaming, the SRC attribute value of the, tag that does not generate the graphics file on the server will point to another. aspx page that is responsible for generating the drawing.
ImageMap, the actual graphic is not displayed, only the image hot zone (image map) is created.
The default value is Imagetag, which is to generate temporary files on the server side.

2, Chart.imagestoragemode
This property determines how the generated graphics are stored, with two options:
useHttpHandler, the default value that is stored by the HTTP handler for the graphics file into memory or file. But the generated file client is not able to directly over URL access to the, tag of the SRC attribute value shape such as:
chartimg.axd?i=chart_67fdbfec448349e686916b97f1351e90_0.png&g=f96eecccd0334d70b8c9b0702894182b
Does not point to a physical storage location on the server side.
useimagelocation, stored as temporary files on the server at the specified location. The client can get the picture directly through the URL. You can further specify the location of the picture storage directory. The picture file name can be random or fixed.

3, Chart.imagetype
The format of the generated graphics file can be BMG, JPEG, PNG, EMF.

Now back to chart.imagelocation, in fact, it has already mentioned its role, is to determine the graphics temporary file URL rules and how to generate temporary files.
(1), this attribute is only valid at chart.imagestoragemode=useimagelocation.
(2), when Chart.rendertype=imagetag, the graph file will be saved on the server after it is generated. The file format and extension are specified by Chart.imagetype. The file name can be static or dynamically variable. Static is the use of a fixed name, dynamic uses a random name, you can use the "#" tag to choose the GUID or specify a sequence of numbers to determine a unique file name.
(3), the default value chartpic_#seq (300,3) means
(4), imagelocation naming example, assuming chart.imagetype=png
Property values generate graphic file URLs
----------------------------------------------------------------
Chartpic_#seq (300,3) chartpic_000003.png?d155074d-2120-49db-a95c-6a4a61911315
Chartpic CHARTPIC.PNG?27194803-A8A9-4C3E-81A7-5534A279DBE0
Chartpic#noguidparam Chartpic.png
(5), default valuechartpic_#seq (300,3)Description
Chartpic_is a prefix ,#SEQ is a sequence of numbers, which means that up to 300 files are allowed and3 for 3 seconds, indicating the time limit for writing warning messages to the event log.

Iii. Web. config Associated configuration item
The configuration in Web. config will only take effect when chart.imagestoragemode=usehttphandler. That is, the configuration in Web. config takes effect when you specify that the graphics file is stored by an HTTP handler.
For example:
<add key= "Chartimagehandler" value= "storage=file;timeout=20;dir=c:/tempimagefiles/;d eleteafterservicing=false ; Webdevserveruseconfigsettings=false "/>
Obviously, C:/tempimagefiles/is the HTTP handler to store the graphics file's directory.
Deleteafterservicing, after the picture is successfully downloaded by the browser, determine whether the server slice is deleted, the default value is False.
Note, however, that if you do not specify deleteafterservicing, the picture will not be stored as a file, it should only be in memory temporarily.
Webdevserveruseconfigsettings, when running in the full trust level environment in the VS development Server, determines whether the resulting picture is saved in memory.

Iv. Note the permissions of the folder
As long as the graphics file is generated on the server, regardless of which directory it is stored in, ASP. NET account is required to have write access to the directory.

[to] the imagelocation attribute meaning of the MSChart component in. NET 3.5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.