Beispiel #1
0
        static void RunLineChart()
        {
            int category_max = 3;
            int data_max = 200;
            LineChart.Data[] data = new LineChart.Data[category_max];
            string[] xlabel = new string[data_max];

            for (int x = 0; x < data_max; x++)
            {
                xlabel[x] = "x" + x;
            }

            for (int x = 0; x < category_max; x++)
            {
                data[x] = new LineChart.Data();
                data[x].data = new float[data_max];
                data[x].label = "label" + x; 
                for (int y = 0; y < data_max; y++)
                {
                    data[x].data[y] = (float)Math.Sin(y * Math.PI * 2.0f / 200.0f) * (x + 1);
                }
            }
            data[1].show_point = true;
            data[2].fill = true; 

            LineChart lc = new LineChart();

            lc.GenerateSimpleHtml("line_chart.html", "sample", data, xlabel, "x-label", "y-label"); 


        }
Beispiel #2
0
        public void GenerateSimpleHtml(string filename, string title, LineChart.Data[] data, string[] xlabel, string xtitle, string ytitle)
        {
            string bc_id = "bc_id";

            CSFlotr2Core gbc = new CSFlotr2Core();


            StreamWriter writer =
                new StreamWriter(filename, false, UTF8Encoding.UTF8);


            writer.WriteLine("<html lang='ja' dir='ltr'>");
            writer.WriteLine("<head>");
            writer.WriteLine("<meta charset='utf-8'>");

            writer.WriteLine(gbc.Include());

            writer.WriteLine(gbc.GenerateGraphHeader(bc_id, null));



            writer.WriteLine("</head>");
            writer.WriteLine("<body>");


            writer.WriteLine(gbc.GenerateGraphTitle(bc_id, title));
            writer.WriteLine(GenerateGraphBody(bc_id, data, xlabel, xtitle, ytitle));



            writer.WriteLine("</body>");
            writer.WriteLine("</html>");
            writer.Close();
        }