public void GenerateSimpleHtml(string filename, string title, RadarChart.Data[] data, string[] xlabel) { 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)); writer.WriteLine("</body>"); writer.WriteLine("</html>"); writer.Close(); }
static void RunRadarChart() { int category_max = 3; int data_max = 7; RadarChart.Data[] data = new RadarChart.Data[category_max]; string[] ticks_label = new string[data_max]; for (int i = 0; i < ticks_label.Length; i++) { ticks_label[i] = "tick_" + i; } Random rand = new Random(); for (int x = 0; x < category_max; x++) { data[x] = new RadarChart.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] = rand.Next(5) + 1; } } RadarChart lc = new RadarChart(); lc.SetMax(6.0f); lc.GenerateSimpleHtml("radar_chart.html", "sample", data, ticks_label); }