Museum___Rubber_boots_by_schnellfahrer

Now, I am the guy who clean shoes.

In this article, I do not want to describe what is VisiFire and how it works, you can get more information about it in its own main web site.

During developing SQL Report , I decided to use the newest version of VisiFire as my default charts rendering,  so I downloaded the version 2.0.9beta from the main site. I found some XML formats been modified, more important, I found the good feature of VisiFire that making the chart to fit the container automatically is not existing anymore.

The symptom is that there is nothing in the navigator when the width and height have not been set in the XML data, so I had to make some changes of the source code of VisiFire.

There is a dirty and ugly temporary solution for this (Why it is dirty and ugly? Because I want the solution to be navigator-independent, so I decided to do not use XML parser and regular-expression to implement this solution), here is the solution:

Opening the source code file “Visifire2.js”,making sure you are using the appropriate version “Visifire2.js v2.0.9 beta”(You can found this information at the top of this file ).

Navigating to the line 262, modifying the source code of the function “render” as the following fragment:

if (_uThisObject.dataXml != null) {
    //////////////////////Begin Add by JeasonZhao//////////////////////////////////////
    var chartXml=_uThisObject.dataXml;
    var nChartSep=chartXml.indexOf(">");
    if(nChartSep>0)
    {
        var chartx=chartXml.substring(0,nChartSep);
        var isQuoted=chartx.indexOf("\"")>=0;
        var nW=chartXml.indexOf("Width");
        var nH=chartXml.indexOf("Height");
        if(nW<=0)
        {
            chartx+=" Width="+(isQuoted?"\"":"'")+width+(isQuoted?"\"":"'");
        }
        if(nH<=0)
        {
            chartx+=" Height="+(isQuoted?"\"":"'")+height+(isQuoted?"\"":"'");
        }
        if(nW<=0||nH<=0)
        {
            _uThisObject.dataXml=chartx+chartXml.substring(nChartSep);
        }
    }          
    /////////////////////End Add by JeasonZhao///////////////////////////////////////
    window["getDataXml" + _uThisObject.index] = function(sender, args) {
        var _uThisObj = _uThisObject;
        return _uThisObj.dataXml;
    };

    html += 'dataXml=getDataXml' + _uThisObject.index + ',';
}

It is assume that you can understand the JavaScript source code, so I do not need to do more explanation.

Further more, I have reported a bug to the authors of Visifire for this, I hope they can fix it in the C# source code rather than JavaScript source code.


Jeason Zhao (沈胜衣,斛律光) ------雪饮再现,一个人的江湖
我知道我是谁,我是沈胜衣,默默的活着,就像空气。