VML Chart control

zhaozj2021-02-17  54

File: vmlgraph1_0_1.js

/ / -------------------------------------------------------------------------------------------- ------------ // Copyright (c) 2003-2004 Leadinsoft. All rights reserved.// Version 1.0.1 // ahthor Dolphin // ----------- ------------------------------------------------ VAR bstsingle = 0; // Chart border is single line var bstdouble = 1; // Chart border is double line var fstsolid = 0; // chart background solid fill var fstTexture = 1; // chart background material Plip VAR fstregular = "regular" // Font: Normal var fstitalic = "italic"; // font: Intragonal var fstbold = "bold"; // font: bold var atleft = "left"; // chart title Left align VAR atcenter = "center"; // Chart Title hidden VAR ATRIGHT = "Right"; // Chart title right alignment

/ / Define VML Chart base class Function graph () {this.text = new text (); this.border = new border (); this.width = 500; this.height = 300; this.Fill = new Fill () "This.Legend = new legend (); this.seriescollection = []; this.container = null; this.shadow = false; THIS.VMLOBJECT = null;};

// Get a reference var_p = graph.prototype; // by the base class, CHART_P.INITIALISE = function () {if (this.container == null) return; var o; // Picture outside box VAR Group = Document.createElement ("v: group"); group.style.width = this.width "pt"; group.style.height = this.height "pt"; group.coordsize = this.width * 10 ", " this.Height * 10; group.id =" group1 ";

// Add a background layer var vrect = document.createElement ("v: Rect"); vRect.Style.Width = (this.width * 10-100) "px"; vRect.Style.Height = this.Height * 10 "PX"; VRECT.COORDSIZE = "21600, 21600";

Group.appendchild (vRect); o = vRect; // Set the border size vRect.Strokeweight = this.border.width; // Set the border color vRect.StrokeColor = this.border.color; // Set the background IF (this.fill .Style == fstSolid) {vRect.fillcolor = this.Fill.Color;}! else {if (this.Fill.background = null) vRect.style.backgroundImage = this.Fill.background; else vRect.fillcolor = this. Fill.color;} // border is double line IF (this.border.style == bstdouble) {var TMP = Document.createElement ("v: Rect"); tmp.style.width = (this.width * 10 -300) "PX"; tmp.style.Height = (this.Height * 10-200) "px"; tmp.style.top = "100px"; tmp.style.left = "100px"; TMP. strokecolor = this.border.color; if (this.fill.style == fstsolid) {tmp.fillcolor = this.fill.color;} else {if (this.Fill.Background! = null) TMP.Style.BackgroundImage = this.Fill.background; else tmp.fillcolor = this.Fill.Color;} var filltmp = document.createElement ( "v: fill"); filltmp.type = "Frame"; tmp.appendChild (filltmp); group.appendChild (TMP); o = TMP;} // Draw title Var vcaptio n = document.createElement ("v: textbox"); vcAption.style.fontsize = this.text.font.size "px"; vcAption.style.color = this.text.font.color; vcAption.style.Height = this.text.height "px"; vcAption.style.fontweight = this.text.fontweight = this.text.font.style; vcAption.innerhtml = this.text.text; vcAption.style.Textalign = this.Text.Alignment;

O.Appendchild (VcAption);

// Draw Shadow IF (this.Shadow) {var vshadow = document.createElement ("v: shadow"); vshadow.on = "t"; vshadow.type = "single"; vshadow.color = "graytext"; vshadow .offset = "4px, 4px"; vRect.Appendchild (vshadow);} this.vmlobject = group; this.container.Appendchild (group);}; // draw specific graph_p.draw = function () {Alert "Base class is not able to instantiate specific data");

// Add sequence _p.addseries = function (o) {var iCount = this.seriescollection.Length; if (o.title == null) o.title = "series" icount; this.seriescollection [icount] = O };

// Value_p.maxs = function () {var max = 0; for (var i = 0; I

/ / Re-serve Object's TOSTRING method_P.TOString = function () {return "OGRAPH";

// Define the VML Chart Border Class Function Border () {this.color = "Black"; this.style = bstsingle; this.width = 1;};

// Define VML Chart Background Function Fill () {this.color = "White"; this.background = null; this.style = fstsolid;};

/ / Define VML Chart Title Function Text () {this.alignment = atcenter; this.Height = 24; this.Font = New font (); this.text = "VML Chart Version 1.0";

/ / Define VML Chart font class function font () {this.color = "black"; this.family = "arial"; this.size = 12; this.style = fstregular;};

// Define the VML Chart map class Function legend () {this.font = new font ();

/ / Define VML Chart Sequence Class Function Series () {this.color = Series.getColor (); this.title = null; this.all = [];}; // Get a color series.getColor = Function ) {RTURN "RGB (" Math.Round (Math.random () * 255) " Math.Round (Math.random () * 255) ", " Math.Round (Math.random ) * 255) ")";}; var _p = series.prototype; // increase specific data _p.adddata = function (sname, svalue, shref, stooltiptext) {var odata = new object (); odata.name = sName; oData.Value = sValue; oData.Href = sHref; if (sTooltipText == null || sTooltipText == "undefined") oData.TooltipText = "value of this item:" sValue; else oData.TooltipText = sTooltipText Var iCount = this.all.Length; this.all [iCount] = odata;}; // ask the maximum value_p.max = function () {var max = 0; for (var i = 0; i < THIS.ALL.LENGTH; I ) {IF (this.all [i] .value> max) Max = this.all [i] .value;} return max;

// Rear dash Object's TSTRING method_P.toString = function () {return "oseries";

/ / Define VML Chart Time Series Function TimeSeries () {series.call (this);}; var _p = TimeSeries.Prototype = new series; // Add specific data _p.adddata = function (Stime, Svalue, Stype, Shref, stooltiptext) {var = new object (); var dt = new date (EVAL (STIME * 1000)); if (stype == "minute") {odata.name = dt.getHours () ":" DT.GETMINUTES ();} else if (stype == "hour") {odata.name = dt.GetHours ();} else if (stype == "day") {odata.name = evAl (Dt.getMonth () 1) "Month" DT.Getdate () "Day";} else} (stype == "month") {odata.name = dt.getYear () "Year" Eval (DT. GetMonth () 1) "Month";} else {odata.name = dt.getyear () "Year"}}}} odata.value = svalue; odata.href = shref; odata.tooltiptext = "This item is: " Svalue ", Time: " DT.Getyear () " Year " Eval (DT.GETMONTH () 1) " Month " DT.Getdate () " Day " Dt.GetHours () ":" DT.GETMINUTES () ":" Dt.getSeconds (); var iCount = this.all.Length; this.all [icount] = odata;}; // Reserved Object's Tostring method_ P.TOSTRING = function () {return "otimeseries";

/ / Define VML Chart Coordinate Eserts Function Axis () {this.color = "Black"; this.ln = 0; this.Numberformat = 0; this.prefix = null; this.suffix = null; this.spacing = 30 Id.width = 0; this.ShowPoint = 12;};

// VerticalChart class, inherited graphfunction verticalchart () {graph.call (this); this.margin = new array (300, 100, 300, 200); this.axisx = new axis (); this.axisy = new axis ();}; var_p = VERTICALCHART.PROTIPE = New graph; // Painting coordinate _P.drawcoord = function (OCONTAINER) {this.AxiSy.ln = Eval (this.height * 10 - this.margin [3]) - this.margin [1 ] - 400; VAR VLINE = Document.createElement ("v: line"); vline.id = "idcoordy"; VLINE.FROM = this.margin [0] "," this.margin [1]; VLINE. To = this.margin [0] "," EVAL (this.Height * 10 - this.margin [3]); vline.style.zindex = 8; VLINE.Style.Position = "absolute"; Vline.StrokeColor = this.AxiSy.color; VLINE.STROKEWEIGHT = 1; var vStroke = Document.createElement ("v: stroke"); vStroke.startarrow = "classic";

VLINE.APpendChild (vStroke); OContainer.Appendchild (VLINE);

THIS.AXISx.ln = evAl (this.width * 10 - this.margin [0]) - this.margin [2] - 300; var Vline = document.createElement ("v: line"); VLINE.ID = " IDCOORDX "; VLINE.FROM = this.margin [0] ", " EVAL (this.height * 10 - this.margin [3]); VLINE.TO = EVAL (this.width * 10 - this.margin [ 2]) "" EVAL (this.height * 10 - this.margin [3]); VLINE.Style.zindex = 8; VLINE.StyLe.Position = "absolute"; Vline.StrokeColor = this.axisx. Color vline.strokeweight = 1;

VAR vStroke = Document.createElement ("v: stroke"); vStroke.endarrow = "classic";

Vline.Appendchild (vStroke); OContainer.Appendchild (VLINE);

// Draw X-axis scale _p.drawlinex = function (OCONTAER) {var TotalPoint = this.seriescollection [0] .all.Length; var iCol = TotalPoint 1; var fcolwidth = math.fllor (this.axisx.ln / Icol); this.axisx.width = fcolwidth; var showpoint = this.axisx.showpoint, step = 1; if (TotalPoint> showpoint) {if (TotalPoint

For (var i = 1; i <= showpoint; i ) {ln = i * step; if (ln> totalpoint) Break; newline = document.createElement ("v: line"); px = this.margin [0] (i-1) * fcolwidth * step; newline.from = px "," y; newline.to = px "," evAl (y this.axisx.spacing); newline.style.zindex = NEWLINE.Style.Position = "absolute";

Newstroke = document.createElement (" ");

NEWTEXT = Document.createElement (" "); newText.innerHtml = this.seriescollection [0] .all [ln-1] .name; newshape.Appendchild (newtext); ocontainer.Appendchild (newshape);} }

// Draw Y-axis scale _p.drawliney = function (OCONTAER) {var maxdata = this.maxs (); maxdata = (4 - maxdata% 4) var showpoint = this.axisy.showpoint; var DCS = 1; for (VAR i = showpoint; i> 0; i -) {if (MaxData% i == 0) {dcs = i; this.axiiSy.showpoint = i; break;}} var newline, newstroke, newshape, newtext; Var py; var x = this.margin [0]; var FrowHeight = math.floor (this.axisy.ln / dcs); this.axisy.width = maxdata; // Y axis stores maximum

For (var i = 0; i <= dcs; i ) {py = evAl (this.Height * 10 - this.margin [3]) - i * flowheight; if (i! = 0) {newline = document.createElement ("v: line"); newline.From = evacing "," py; newline.to = x "," py; newline.style.zindex = 8; newline .Style.Position = "absolute";

Newstroke = Document.createElement (" ");

NEWTEXT = Document.createElement (" "); newText.innerHTML = i * (maxdata / dcs); newshape.Appendchild (newText); OContainer.Appendchild (newshape);}};

{Var Arrseries = function (OCONTAER) {var arrseries = this.seriescollection; for (var i = 0; i

Var newshape = document.createElement (" ");

VAR newText = Document.createElement (" ");

Newtext.innerhtml = "" arrseries [i] .title; newshape.Appendchild (newtext); ocontainer.appendchild (newshape);}}; // --------------- -------------------------------------------------- --------- // Vertical column graph, inherit the verticalChart class function verticalbarchart () {verticalchart.call (this);}; var _p = verticalbarchart.prototype = new verticalChart;

// Heavy flower X-axis scale _P.drawLinex = function (OCONTAER) {var TotalPoint = this.seriescollection [0] .all.Length; var iCol = TotalPoint 1; var fcolwidth = math.floor (this.axisx.ln / ICOL); this.axisx.width = fcolwidth; var showpoint = this.axisx.showpoint, step = 1; if (TotalPoint> showpoint) {if (TotalPoint

THIS.AXISx.ShowPoint = showpoint; var newline, news; newshape, newtext; var px, ln; var y = evAl (this.height * 10 - this.margin [3]);

For (var i = 1; i <= showpoint; i ) {ln = i * step; if (ln> totalpoint) Break; newline = document.createElement ("v: line"); px = this.margin [0] i * fcolwidth * step; newline.from = px "," y; newline.to = px "," evAl (y this.axisx.spacing); newline.style.zindex = 8; newline. Style.Position = "absolute";

Newstroke = Document.createElement (" "); newText = Document.createElement (" "); // alert (this.axisx.width) Ocontainer.appendchild (newshape);}}}; // ------------------------------------- -------------------------------- -------- // ---------------------------------------- -------------------------------------- // vertical line graphics, inherit the VerticalChart class Function verticalLinechart () {verticalChart.call (this); this.isdrawpoint = true;}; var_p = verticalLinechart.prototype = new verticalChart

// Draw verticalLineChart_p.draw = function () {if (this.border.style == 1) {this.margin = new Array (400, 200, 400, 300);}

var oContainer = this.VMLObject; this.AxisY.showPoint = 10; this.drawCoord (oContainer); this.drawLineX (oContainer); this.drawLineY (oContainer); this.drawSmallSeries (oContainer); this.drawLine (oContainer); }

// Data of VerticalLineChart_P.drawLine = Function (Ocontainer) {var arrseries = this.seriesCollection; var fcolwidth, dcs; fcolwidth = this.axisx.width; dcs = this.axisy.ln / this.axiSy.Width Var ivalueln, iSeriesln; iSeriesln = arrseries.length var Points = New Array (iSeriesln); Var L, T, Barheight; for (var i = 0; i

arrSeries [i] .all [k] .TooltipText; oContainer.appendChild (newOval);}} oContainer.appendChild (newPolyLine);}}; // ----------------- -------------------------------------------------- ---------- File: VMLGRAPH1_0_1.HTM

test vml chart for ver Version 1.0.1 </ title> <style> v /: * {behavior: URL (# default # VML)} </ style> <script language = "javascript" src = "vmlgraph1_0_1.js"> </ script> </ HEAD></p> <p><Body> <div id = TEST1> <script language = "javascript"> <! - var tmp = new array ();</p> <p>// Columnum map // var chart = new verticalbarchart ();</p> <p>// Line map var chart = new verticalLinechart ();</p> <p>Chart.text.font.size = 24; chart.text.font.style = fstbold; chart.shadow = true; chart.Container = test1; chart.initialise ();</p> <p>Var s = new series (); var label = new array ("Jan", "Feb", "Mar", "APR", "May", "Jun", "Jul", "AUG", "SEP", "OCT", "NOV", "DEC");</p> <p>For (var i = 0; i <label.Length; i ) {v = math.Round (Math.random () * 1000); TMP [Tmp.Length] = V; S.Adddata (Label [i], V );} s.Title = "Series 1"; s.color = "red"; chart.addseries (s);</p> <p>S = new series (); for (var i = 0; i <label.length; i ) {v = math.Round (Math.random () * 1000); S.Adddata (Label [i], v); } S.Title = "Series 2"; S.COLOR = "Green"; chart.addseries (s);</p> <p>Chart.draw ();</p> <p>// -> </ script> </ div> </ body> </ html></p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-29099.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="29099" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.044</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'Bf4Cew3p6vehNbUh0VX0tVf7wVJoNPWuh_2F7ntuBNuwN25Wz_2F0uk1hVquO1jDJEoXBvqQjSkLbzVckwoCc9Y4WQ_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>