123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- function createTChart(tChartID, leftPx, topPx, widthPx, heightPx, parentObj) {
- if( parentObj == null )
- parentObj = body;
- var tChartObj = parentObj.createChild("xforms:object", "id:" + tChartID + "; clsid:{fab9b41c-87d6-474d-ab7e-f07d78f2422e}; left:" + leftPx + "px; top:" + topPx + "px; width:" + widthPx + "px; height:" + heightPx + "px; ")
- return tChartObj;
- }
- function createTChart8(tChartID, leftPx, topPx, widthPx, heightPx, parentObj) {
- if( parentObj == null )
- parentObj = body;
- var tChartObj = parentObj.createChild("xforms:object", "id:" + tChartID + "; clsid:{BDEB0088-66F9-4A55-ABD2-0BF8DEEC1196}; left:" + leftPx + "px; top:" + topPx + "px; width:" + widthPx + "px; height:" + heightPx + "px; ")
- return tChartObj;
- }
- function clearTChart(tChartObj) {
- tChartObj.RemoveAllSeries();
- tChartObj.Tools.clear()
- }
- function drawBar(tChartObj, gridObj ,yColRef , title, pivot) {
-
- clearTChart(tChartObj);
- tChartObj.Header.Text(0) = title;
- tChartObj.Aspect.View3D = 0;
- if( pivot )
- pivot = 2;
- else
- pivot = 1;
- tChartObj.AddSeries(pivot);
- tChartObj.Legend.setVisible(false);
- tChartObj.Series(0).marks.setVisible(false);
- var Rnd1, Rnd2, Rnd3;
- var cColor;
- var i;
- var x, y;
- var yCol = gridObj.colRef(yColRef);
-
- for (i = gridObj.fixedRows; i < gridObj.rows; i++ ) {
- Rnd1 = Math.random();
- Rnd2 = Math.random();
- Rnd3 = Math.random();
- cColor = window.rgb( (255 - 1) * Rnd1 + 1, (255 - 1) * Rnd2 + 1 , (255 - 1) * Rnd3 + 1);
- x = gridObj.valueMatrix(i, 0);
- y = gridObj.valueMatrix(i, yCol);
- tChartObj.Series(0).Add (y, x, cColor);
- }
- }
- function drawSelectBar(chart, grid, title, rows, cols, legend, pivot, type) {
-
- clearTChart(chart);
- chart.Header.Text(0) = title;
- chart.Aspect.View3D = 0;
- if( pivot ) {
- pivot = 2;
- } else {
- pivot = 1;
- }
- if (legend) {
- chart.Legend.setVisible(true);
- } else {
- chart.Legend.setVisible(false);
- }
- if (type == "row") {
- var r, g, b, color;
- var x, y;
- for (var i = 0; i < cols.length; i++ ) {
- chart.AddSeries(pivot);
- var idx = chart.SeriesCount -1;
- chart.Series(idx).title = grid.valueMatrix(0, cols[i]);
- chart.Series(i).marks.setVisible(false);
- r = Math.random();
- g = Math.random();
- b = Math.random();
- color = window.rgb( (255 - 1) * r + 1, (255 - 1) * g + 1 , (255 - 1) * b + 1);
- for (var j = 0; j < rows.length; j++) {
- x = grid.valueMatrix(rows[j], 0);
- y = grid.valueMatrix(rows[j], cols[i]);
-
- chart.Series(i).Add (y, x, chart.Series(idx).Color);
- chart.Series(i).LegendItemColor(color)
- }
- }
- } else if (type == "col") {
- var r, g, b, color;
- var x, y;
- for (var i = 0; i < rows.length; i++ ) {
- chart.AddSeries(pivot);
- var idx = chart.SeriesCount -1;
- chart.Series(idx).title = grid.valueMatrix(rows[i], 0);
- chart.Series(i).marks.setVisible(false);
- r = Math.random();
- g = Math.random();
- b = Math.random();
- color = window.rgb( (255 - 1) * r + 1, (255 - 1) * g + 1 , (255 - 1) * b + 1);
- for (var j = 0; j < cols.length; j++) {
- x = grid.valueMatrix(0, cols[j]);
- y = grid.valueMatrix(rows[i], cols[j]);
-
- chart.Series(i).Add (y, x, chart.Series(idx).Color);
- chart.Series(i).LegendItemColor(color)
- }
- }
- }
- }
- function drawLine(tChartObj, gridObj, row, title, refresh) {
-
- if( refresh ) {
- clearTChart(tChartObj);
- }
- if( title != null || title == "" ) {
- tChartObj.Header.Text(0) = title;
- }
- tChartObj.Aspect.View3D = 0;
- tChartObj.Legend.CheckBoxes = true;
- tChartObj.Legend.Alignment = 0;
- var Rnd1, Rnd2, Rnd3;
- var cColor;
- var i;
- var x, y;
- tChartObj.AddSeries(0);
- var seriesIndex = tChartObj.SeriesCount - 1;
- var trgRow = row;
- tChartObj.Series(seriesIndex).asLine.Pointer.Visible = true;
- tChartObj.Series(seriesIndex).asLine.Pointer.Style = 1;
- tChartObj.Series(seriesIndex).Title = gridObj.valueMatrix(trgRow, 0);
-
- Rnd1 = Math.random();
- Rnd2 = Math.random();
- Rnd3 = Math.random();
- cColor = window.rgb( (255 - 1) * Rnd1 + 1, (255 - 1) * Rnd2 + 1 , (255 - 1) * Rnd3 + 1);
- for( i = gridObj.fixedCols; i < gridObj.cols; i++ ){
- x = gridObj.valueMatrix(0, i);
- y = gridObj.valueMatrix(trgRow, i);
- tChartObj.Series(seriesIndex).Add (y, x, tChartObj.Series(seriesIndex).Color);
- tChartObj.Series(seriesIndex).LegendItemColor(cColor);
- }
- }
- function drawOneTChart(tChartObj, gridObj, row, title, refresh) {
- drawLine(tChartObj, gridObj, row, title, refresh);
- }
- function drawLineAll(tChartObj, gridObj, title) {
- for( var i = gridObj.fixedRows; i < gridObj.rows; i ++)
- drawOneTChart(tChartObj, gridObj, i, title, false);
- }
- function drawAllTChart(tChartObj, gridObj, title) {
- drawLineAll(tChartObj, gridObj, title);
- }
- function setBackImageLoad(tChartObj, imgCd){
- tChartObj.Panel.BackImageLoad(getTChartBackgroundImage(imgCd));
- }
- function getTChartBackgroundImage(imgcd){
- return "C:\\Program Files\\himed\\components\\ClipSoft\\teechart7\\images\\"+imgcd+".gif";
- }
|