Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
XML
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("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 = 4;
    Int32 _tomonth = 9;
    Int32 _loop = _tomonth - _frommonth;
    Int32 _val = _tomonth - _frommonth;
    _strdata += "<categories>";
    int i = 0;
    for ( i = 4; i <= 9; i++)
    {
        _strdata += "<category label='" + ItemList[i] + "' /> ";
    }

    String _lastyer = "0";
    Int32 _status = 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;
                }

                _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; k++)
        {
            if (k.ToString() != _ds.Tables[0].Rows[j]["Month"].ToString())
            {
                _status = 1;
                //break;
            }
            else
            {
                _status = 0;
                break;
            }
        }

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

        _loop = _loop - 1;
    }

    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", "600", "500", false);
    //Response.Write(_strdata);

}
Posted

1 solution

 
Share this answer
 
v2
Comments
Sandeep Mewara 21-Jun-12 17:02pm    
Good links. 5!
Prasad_Kulkarni 21-Jun-12 23:33pm    
Thank you Sandeep!

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