Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
2.00/5 (4 votes)
See more:
C#
private void M_getreport() 
{
    String _strdata = "<chart caption='Temperature Monitoring (in degree C)' subCaption='(on 7/9/2006)' xAxisName='Time' yAxisMaxValue='100' bgColor='91AF46,FFFFFF'  divLineColor='91AF46' divLineAlpha='30' alternateHGridAlpha='5' canvasBorderColor='666666' baseFontColor='666666' lineColor='91AF46' numVDivlines='7' showAlternateVGridColor='1' anchorSides='3' anchorRadius='5' showValues='0' >";
    ArrayList ItemList = new ArrayList();
    ItemList.Add("No");
    ItemList.Add("JA");
    ItemList.Add("FB");
    ItemList.Add("MR");
    ItemList.Add("AP");
    ItemList.Add("MA");
    ItemList.Add("JU");
    ItemList.Add("JL");
    ItemList.Add("AU");
    ItemList.Add("SE");
    ItemList.Add("OC");
    ItemList.Add("NA");
    ItemList.Add("DS");
    Int32 _frommonth = 3;
    Int32 _Tfrommonth = 3;
    Int32 _tomonth = 9;
    Int32 _loop = _tomonth - _frommonth;
    Int32 _val = _tomonth - _frommonth;
    _strdata += "<categories>";
    int i = 0;
    for (i = _frommonth; i <= _tomonth; i++)
    {
        _strdata += "<category label='" + ItemList[i] + "' /> ";
    }

    String _lastyer = "0";

    _strdata += "</categories>";

    var random = new Random();

    DataSet _ds = _ManagePointMaster.SP_checkreport(2009, 2012, _frommonth, _tomonth);

    for ( int j = 0; j < _ds.Tables[0].Rows.Count;j++)
    {
        if(_lastyer!=_ds.Tables[0].Rows[j]["year"].ToString())
        {
            if (_lastyer != "0")
            {

                if (_loop < _val)
                {
                    for (i = 0; i <= _loop; i++)
                    {
                        _strdata += "<set value='0' /> ";
                    }
                    _loop = _val;
                    _frommonth = _Tfrommonth;
                }

                _strdata += "</dataset>";

            }
            //var color = String.Format("#{0:X6}", random.Next(0x1000000));

            _strdata += "<dataset seriesName='" + _ds.Tables[0].Rows[j]["year"].ToString() + "' color='" + String.Format("#{0:X6}", random.Next(0x1000000)) + "'>";

            _lastyer = _ds.Tables[0].Rows[j]["year"].ToString();
        }

        for (Int32 k = _frommonth; k <= _tomonth+1; k++)
        {
            if (k.ToString() != _ds.Tables[0].Rows[j]["Month"].ToString())
            {
                _status = 1;
                _strdata += "<set value='0' /> ";

                _loop = _loop - 1;
                _frommonth += 1;
                //break;
            }
            else
            {
                _strdata += "<set  value='" + _ds.Tables[0].Rows[j]["LID"].ToString() + "' /> ";

                   _loop = _loop - 1;
                _frommonth += 1;
                break;
            }
        }


    }

    if (_loop < _val)
    {
        for (i = 0; i <= _loop; i++)
        {
            _strdata += "<set value='0' /> ";
            }

    }

    _strdata += "</dataset>";


       _strdata += "<styles>";
        _strdata += "<definition>";

        _strdata += "<style name='Anim1' type='animation' param='_alpha' start='0' duration='1' />";

    _strdata += "</definition>";

    _strdata += "<application>";

        _strdata += "<apply toObject='TRENDLINES' styles='Anim1' />";

    _strdata += "</application>";

_strdata += "</styles>";

    _strdata += "</chart>";


    txtdescc.Text = _strdata;
    Literal2.Text = FusionCharts.RenderChartHTML("FusionCharts/ScrollLine2D.swf", "", _strdata.ToString(), "myNext", "800", "500", false);
    //Response.Write(_strdata);

}
Posted
Updated 29-Jun-12 2:28am
v2
Comments
ZurdoDev 29-Jun-12 8:28am    
Do you have a question?
Dylan Morley 29-Jun-12 8:30am    
That looks lovely, do you have a question?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900