public void Graduation_axes(double a, double b, double interval, double j, double grad, bool index) { double text = 0.1; double[] arr; for (double i = a + interval; (i <= b && a < b) || (i >= b && a > b); i = i + interval) { if (index) { arr = new[] { j + 4, i, j - 4, i }; shapes.Text(grad, i - 10, text.ToString(), Convert.ToInt32(Math.Abs(interval) * 0.4)); } else { arr = new[] { i, j + 4, i, j - 4 }; shapes.Text(i, grad, text.ToString(), Convert.ToInt32(Math.Abs(interval) * 0.4)); } shapes.Draw_polyline(arr, 2, Colors.Black, false); text = text + 0.1; } }
public Color[] Name_area(int left_lim, int right_lim, int select_index, double l, double h) { var str_name = String.Empty; var shapes = new Main_figures(gr); int count = right_lim - left_lim - 1; Color[] color = new Color[count]; count = 0; var gr_table2 = list_gr2[select_index]; for (int i = left_lim + 1; i < right_lim; i++) { var gr_table1 = list_gr1[i]; str_name = gr_table2.Name + gr_table1.Name; switch (Convert.ToInt32(str_name)) { case 55: case 45: case 54: color[count++] = Colors.DimGray; shapes.Text(l + (koef * h) / 10.5 * 12 - 20, 600, Name_Oblast_ST[4], Convert.ToInt32(0.5 * (koef * h) / 10.5)); shapes.Draw_Rect(l + (koef * h) / 10.5 * 12 - 65, 590, 40, 40, Colors.DimGray, 1); break; case 44: case 53: color[count++] = Colors.Gray; shapes.Text(l + (koef * h) / 10.5 * 12 - 20, 550, Name_Oblast_ST[3], Convert.ToInt32(0.5 * (koef * h) / 10.5)); shapes.Draw_Rect(l + (koef * h) / 10.5 * 12 - 65, 540, 40, 40, Colors.Gray, 1); break; case 43: case 52: case 51: color[count++] = Colors.DarkGray; shapes.Text(l + (koef * h) / 10.5 * 12 - 20, 500, Name_Oblast_ST[2], Convert.ToInt32(0.5 * (koef * h) / 10.5)); shapes.Draw_Rect(l + (koef * h) / 10.5 * 12 - 65, 490, 40, 40, Colors.DarkGray, 1); break; case 42: case 34: case 35: color[count++] = Colors.Silver; shapes.Text(l + (koef * h) / 10.5 * 12 - 20, 450, Name_Oblast_ST[1], Convert.ToInt32(0.5 * (koef * h) / 10.5)); shapes.Draw_Rect(l + (koef * h) / 10.5 * 12 - 65, 440, 40, 40, Colors.Silver, 1); break; default: color[count++] = Colors.Gainsboro; shapes.Text(l + (koef * h) / 10.5 * 12 - 20, 400, Name_Oblast_ST[0], Convert.ToInt32(0.5 * (koef * h) / 10.5)); shapes.Draw_Rect(l + (koef * h) / 10.5 * 12 - 65, 390, 40, 40, Colors.Gainsboro, 1); break; } str_name = str_name.First().ToString(); } return(color); }
public void Graph_Build(List <Class_point_gr> list, bool flag, Canvas gr) { double x_graph_map = 0; double y_graph_map = 0; double interval = 0; var shapes = new Main_figures(gr); for (int index = 0; index < list.Count; index++) { int count = 0; var xy = list[index].xy.Split(';'); //Створюємо масив для роботи з графіком var arr = new double[xy.Length - 1]; for (int i = 0; i < xy.Length - 1; i = i + 2) { if (flag) { x_graph_map = 0.7 * gr.Width / 2; y_graph_map = 20; } else { x_graph_map = 10; y_graph_map = 1.1 * gr.Height / 2; } //Наповнюємо масив відповідними координатами для відмалювання графіка arr[count++] = Convert.ToDouble(xy[i]); arr[count++] = Convert.ToDouble(xy[i + 1]); } Color color; double[] arr_leg; interval = interval + 20; //Вибір кольорів для графіків var gr_table = list[index] as Class_point_gr; switch (gr_table.Name) { case "1": color = Colors.Blue; break; case "2": color = Colors.Green; break; case "3": color = Colors.Yellow; break; case "4": color = Colors.Orange; break; case "5": color = Colors.Red; break; default: color = Colors.Navy; break; } arr_leg = new[] { x_graph_map, y_graph_map + interval, x_graph_map + koef * 60, y_graph_map + interval }; //Відмальвуємо графік shapes.Draw_polyline(arr, 2, color, false); //Підписуємо легенду графіка shapes.Text(x_graph_map + koef * 60 + 10, y_graph_map + interval - 10, _Namegraph(gr_table.Name), Convert.ToInt32(0.25 * (koef * gr.Height) / 10.5)); //Легенда графіка shapes.Draw_polyline(arr_leg, 3, color, false); } }