PageSourceSearch

https://uppolice.gov.in/ScriptResource.axd?d=r3-cz269SIZtEOWYKeHK-…I3qY03TIAi5R6tyvCBl-mPARxa3IZh20&t=51e37521

js uppolice.gov.in collected 2026-09-24 09:57:37 UTC 11,270 bytes, 197 lines download raw bytes

1// Name:        PieChart.PieChart.debug.js
2// Assembly:    AjaxControlToolkit
3// Version:     4.1.7.1213
4// FileVersion: 4.1.7.1213
5Type.registerNamespace("Sys.Extended.UI");
6
7Sys.Extended.UI.PieChart = function (element) {
8    Sys.Extended.UI.PieChart.initializeBase(this, [element]);
9    var id = this.get_id();
10    id = id.replace("_ctl00", "");
11    this._parentDiv = document.getElementById(id + "__ParentDiv");
12
13    this._chartWidth = '300';
14    this._chartHeight = '300';
15    this._chartTitle = '';
16    this._pieChartClientValues = null;
17    this._theme = 'PieChart';
18    this._chartTitleColor = '';
19    this.charLength = 3.5;
20}
21
22Sys.Extended.UI.PieChart.prototype = {
23
24    initialize: function () {
25        Sys.Extended.UI.PieChart.callBaseMethod(this, "initialize");
26
27        if (!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1")) {
28            throw 'Current version of browser does not support SVG.';
29        }
30
31        this.generatePieChart();
32    },
33
34    dispose: function () {
35        Sys.Extended.UI.PieChart.callBaseMethod(this, "dispose");
36    },
37
38    generatePieChart: function () {
39
40        var radius = parseInt(this._chartWidth) > parseInt(this._chartHeight) ? (parseInt(this._chartHeight) - 10) / 3 : (parseInt(this._chartWidth) - 10) / 3;
41        var startX = parseInt(this._chartWidth) / 2;
42        var startY = parseInt(this._chartHeight) / 2.25;
43
44        var svgContents = String.format('<?xml-stylesheet type="text/css" href="{0}.css"?>', this._theme);
45        svgContents = String.format('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="{0}" height="{1}" style="position: relative; display: block;">', this._chartWidth, this._chartHeight);
46        svgContents = svgContents + '<defs>';
47        svgContents = svgContents + String.format('<radialGradient gradientUnits="userSpaceOnUse" r="{0}" fy="{1}" fx="{2}" cy="{1}" cx="{2}">', radius, startX, startY);
48        svgContents = svgContents + '<stop offset="0%" id="RadialGradient1"></stop>';
49        svgContents = svgContents + '<stop offset="25%" id="RadialGradient2"></stop>';
50        svgContents = svgContents + '<stop offset="100%" id="RadialGradient3"></stop></RadialGradient>';
51        svgContents = svgContents + '</defs>';
52        svgContents = svgContents + String.format('<path fill="none" stroke-opacity="1" fill-opacity="1" stroke-linejoin="round" stroke-linecap="square" d="M5 {0} {1} {0} {1} {2} 5 {2} z"/>', parseInt(this._chartHeight) * 1 / 10 + 5, parseInt(this._chartWidth) - 5, parseInt(this._chartHeight) - parseInt(this._chartHeight) * 1 / 10);
53        svgContents = svgContents + String.format('<path id="ChartBackGround" stroke="" d="M0 0 {0} 0 {0} {1} 0 {1} z"/>', this._chartWidth, this._chartHeight);
54        svgContents = svgContents + String.format('<path fill="#ffffff" stroke-opacity="1" fill-opacity="0" stroke-linejoin="round" stroke-linecap="square" stroke="" d="M5 {0} {1} {0} {1} {2} 5 {2} z" />', parseInt(this._chartHeight) * 1 / 10 + 5, parseInt(this._chartWidth) - 5, parseInt(this._chartHeight) - parseInt(this._chartHeight) * 1 / 10);
55        svgContents = svgContents + String.format('<text x="{0}" y="{1}" id="ChartTitle" style="fill:{3}">{2}</text>', parseInt(this._chartWidth) / 2 - (this._chartTitle.length * this.charLength), parseInt(this._chartHeight) * 5 / 100, this._chartTitle, this._chartTitleColor);
56
57        var legendAreaStartHeight = (parseInt(this._chartHeight) * 82 / 100) + 5;        
58        var legendBoxWidth = 7.5;
59        var legendBoxHeight = 7.5;
60        var spaceInLegendContents = 5;
61
62        var legendCharLength = 0;
63        for (var i = 0; i < this._pieChartClientValues.length; i++) {
64            legendCharLength = legendCharLength + this._pieChartClientValues[i].Category.length;
65        }
66
67        var legendAreaWidth = Math.round((legendCharLength * 5) / 2) + Math.round((legendBoxWidth + (spaceInLegendContents * 2)) * this._pieChartClientValues.length);
68        var isLegendNextLine = false;
69        if (legendAreaWidth > parseInt(this._chartWidth) / 2) {
70            legendAreaWidth = legendAreaWidth / 2;
71            isLegendNextLine = true;
72        }
73
74        svgContents = svgContents + '<g>';
75        svgContents = svgContents + String.format('<path d="M{0} {1} {2} {1} {2} {3} {0} {3} z" id="LegendArea" stroke=""></path>', parseInt(this._chartWidth) * 40 / 100 - (legendAreaWidth / 2), legendAreaStartHeight, parseInt(this._chartWidth) * 40 / 100 + (legendAreaWidth / 2), Math.round(parseInt(this._chartHe
75ight) * 97.5 / 100));
76
77        var startText = parseInt(this._chartWidth) * 40 / 100 - (legendAreaWidth / 2) + 5 + legendBoxWidth + spaceInLegendContents;
78        var nextStartText = startText;
79        var startLegend = parseInt(this._chartWidth) * 40 / 100 - (legendAreaWidth / 2) + 5;
80        var nextStartLegend = startLegend;
81
82        for (var i = 0; i < this._pieChartClientValues.length; i++) {
83            if (isLegendNextLine && i == Math.round(this._pieChartClientValues.length / 2)) {
84                startText = parseInt(this._chartWidth) * 40 / 100 - (legendAreaWidth / 2) + 5 + legendBoxWidth + spaceInLegendContents;
85                nextStartText = startText;
86                startLegend = parseInt(this._chartWidth) * 40 / 100 - (legendAreaWidth / 2) + 5;
87                nextStartLegend = startLegend;
88                legendAreaStartHeight = (parseInt(this._chartHeight) * 89 / 100) + 5;
89                isLegendNextLine = false;
90            }
91            startLegend = nextStartLegend;
92            startText = nextStartText;
93            svgContents = svgContents + String.format('<path d="M{0} {1} {2} {1} {2} {3} {0} {3} z" id="Legend{4}" style="stroke:{6};fill:{5}"></path>', startLegend, legendAreaStartHeight + legendBoxHeight, startLegend + legendBoxWidth, legendAreaStartHeight + 15, i + 1, this._pieChartClientValues[i].PieChartValueColor, this._pieChartClientValues[i].PieChartValueStrokeColor);
94            svgContents = svgContents + String.format('<text x="{0}" y="{1}" id="LegendText">{2}</text>', startText, legendAreaStartHeight + 15, this._pieChartClientValues[i].Category);
95            if (this._pieChartClientValues[i].Category.length > 10) {
96                nextStartLegend = startLegend + (this._pieChartClientValues[i].Category.length * 5.5) + legendBoxWidth + (spaceInLegendContents * 2);
97                nextStartText = startText + (this._pieChartClientValues[i].Category.length * 5.5) + legendBoxWidth + (spaceInLegendContents * 2);
98            }
99            else {
100                nextStartLegend = nextStartLegend + (this._pieChartClientValues[i].Category.length * 6) + legendBoxWidth + (spaceInLegendContents * 2);
101                nextStartText = nextStartText + (this._pieChartClientValues[i].Category.length * 6) + legendBoxWidth + (spaceInLegendContents * 2);
102            }
103        }
104        svgContents = svgContents + '</g>';
105
106        var categoryValue = 0;
107        var totalValue = 0;
108        var angle = 0;
109        var radAngle = 0;
110        var textRadAngle = 0;
111        var endX = 0;
112        var endY = 0;
113        var arc = 0;
114        var lastEndX = startX;
115        var lastEndY = startY - radius;
116        var textX = startX;
117        var textY = startY - radius;
118        for (var i = 0; i < this._pieChartClientValues.length; i++) {
119            totalValue = totalValue + Math.abs(parseFloat(this._pieChartClientValues[i].Data));
120        }
121
122        this._parentDiv.innerHTML = svgContents;
123
124        this.drawSegments(this, 0, categoryValue, totalValue, radius, angle, radAngle, textRadAngle, startX, endX, startY, endY, textX, textY, lastEndX, lastEndY, arc);
125    },
126
127    drawSegments: function (me, index, categoryValue, totalValue, radius, angle, radAngle, textRadAngle, startX, endX, startY, endY, textX, textY, lastEndX, lastEndY, arc) {
128        categoryValue = categoryValue + Math.abs(parseFloat(me._pieChartClientValues[index].Data));
129        angle = (categoryValue / totalValue) * 360;
130        radAngle = angle * (Math.PI / 180);
131        textRadAngle = (categoryValue - Math.abs(parseFloat(me._pieChartClientValues[index].Data)) + Math.abs(parseFloat(me._pieChartClientValues[index].Data)) / 2) / totalValue * 360;
132        textRadAngle = textRadAngle * (Math.PI / 180);
133        endX = parseFloat(Math.sin(radAngle) * radius);
134        endY = parseFloat(Math.cos(radAngle) * radius);
135        textX = parseFloat(Math.sin(textRadAngle) * (radius + 10));
136        textY = parseFloat(Math.cos(textRadAngle) * (radius + 10));
137        
138        textX = (startX + textX) > startX ? startX + textX : (startX + textX) - (me._pieChartClientValues[index].Data.toString().length * this.charLength);
139        textY = (startY + (-1 * textY)) < startY ? startY + (-1 * textY) : startY + (-1 * textY) + 10;
140        me._parentDiv.innerHTML = me._parentDiv.innerHTML.replace('</svg>', '') + String.format('<g><path id="Segment{8}" d="M{0} {1} A {2} {2} 0 {3},1 {4} {5} L {6} {7} z" style="stroke:{10};fill:{9};"></path>', lastEndX, lastEndY, radius, arc, startX + endX, startY + (-1 * endY), startX, startY, index + 1, me._pieChartClientValues[index].PieChartValueColor, me._pieChartClientValues[index].PieChartValueStrokeColor) + String.format('<text fill="#000000" style="font: 11px Arial,Helvetica,sans-serif" fill-opacity="1" y="{1}" x="{0}">{2}</text></g>', textX, textY, me._pieChartClientValues[index].Data) + '</svg>';
141        
142        lastEndX = startX + endX;
143        lastEndY = startY + (-1 * endY);
144        index++;
145
146        if (index < me._pieChartClientValues.length) {            //  if the counter < series length, call the loop function
147            setTimeout(function () {
148                me.drawSegments(me, index, categoryValue, totalValue, radius, angle, radAngle, textRadAngle, startX, endX, startY, endY, textX, textY, lastEndX, lastEndY, arc);
149            }, 400);
150        }
151    },
152
153    get_chartWidth: function () {
154        return this._chartWidth;
155    },
156    set_chartWidth: function (value) {
157        this._chartWidth = value;
158    },
159
160    get_chartHeight: function () {
161        return this._chartHeight;
162    },
163    set_chartHeight: function (value) {
164        this._chartHeight = value;
165    },
166
167    get_chartTitle: function () {
168        return this._chartTitle;
169    },
170    set_chartTitle: function (value) {
171        this._chartTitle = value;
172    },
173
174    get_PieChartClientValues: function () {
175        return this._pieChartClientValues;
176    },
177    set_PieChartClientValues: function (value) {
178        this._pieChartClientValues = value;
179    },
180
181    get_theme: function () {
182        return this._theme;
183    },
184    set_theme: function (value) {
185        this._theme = value;
186    },
187
188    get_chartTitleColor: function () {
189        return this._chartTitleColor;
190    },
191    set_chartTitleColor: function (value) {
192        this._chartTitleColor = value;
193    }
194};
195
196Sys.Extended.UI.PieChart.registerClass("Sys.Extended.UI.PieChart", Sys.Extended.UI.ControlBase);
197Sys.registerComponent(Sys.Extended.UI.PieChart, { name: 'PieChart', parameters: [{ name: 'PieChartValues', type: 'PieChartValue[]'}] });

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.