Click here to Skip to main content
15,915,019 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
heyy..

I am using a javascript fusion chart(in C# code). In this I am using ScrollColumn2D fusion chart ..

In this , I want fixed color for each bar ie. if the value >15 then one color and if >25 then another color.. in [Ticketamount bar]


here is my C# code..

XML
grphXML = new StringBuilder();
        grphXML.Append("' <chart palette=\"2\" caption=\"Daily Revenue Details\" numdivlines=\"9\" showValues=\"1\" showAlternateVGridColor=\"1\" xAxisName=\"Date\" yAxisName=\"Amount\" anchorSides=\"10\" anchorRadius=\"3\" anchorBorderColor=\"009900\" decimalPrecision=\"2\" useRoundEdges=\"1\" formatNumberScale=\"0\" scrollToEnd=\"0\">");
        DataTable dtDailyData = ws_reportbusinesrule.GetDailyData(Convert.ToInt32(lblLoctionId.Text));
        if (dtDailyData != null)
        {
            bool IsdataPresent = false;
            grphXML.Append("<categories font=\"Arial\" fontSize=\"11\" fontColor=\"000000\">");
            foreach (DataRow dataRow in dtDailyData.Rows)
            {
                grphXML.Append(" <category label=" + '"' + dataRow["startDay"] + '"' + @"/>");
                IsdataPresent = true;
            }
            grphXML.Append("</categories>");
           // grphXML.Append("<dataset seriesName=\"3 Weeks Before\" color=" + '"' + lstcolor[i + 3] + '"' + @" showValues=" + '"' + 1 + '"' + ">");
            grphXML.Append("<dataset showValues=" + '"' + 1 + '"' + ">");
            foreach (DataRow dataRow in dtDailyData.Rows)
            {
                grphXML.Append("<set value=" + '"' + dataRow["Ticketamount"] + '"' + @"/>");
                 IsdataPresent = true;
            }
            grphXML.Append("</dataset>");

            grphXML.Append("  </chart> '");
            string Revenue = grphXML.ToString();
            if (IsdataPresent)
            {
                string Gal2 = @"<script>

                     if (GALLERY_RENDERER && GALLERY_RENDERER.search(/javascript|flash/i) == 0)
                      FusionCharts.setCurrentRenderer(GALLERY_RENDERER);
                     var chart = new FusionCharts('../../JS/Charts/ScrollColumn2D.swf','ChartId', '450', '400',  '0', '0');
                     chart.setXMLData(" + Revenue + @");
                     chart.render(" + RevenueDetails.ClientID + @");
               </script>";
                ClientScript.RegisterStartupScript(GetType(), "jsdatepic3", Gal2);
            }
        }
        else
        {
            RevenueDetails.InnerHtml = "";
        }
Posted
Comments
sumit_kapadia 8-Aug-13 3:39am    
Fusion chart has lot of documentation/Knowledge base on their site.. Please check there
VishwaKL 26-Aug-13 7:28am    
yes sumit is right, you have to go through the documentation, that helps you

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