//3D scatter chart creation\\ public void createChart(WinChartViewer viewer, int chartIndex) { int[] chartColor = new int[8] { 0xff0000, 0x00ff00, 0x0000ff, 0xffff00, 0xff00ff, 0x55ffff, 0x888888, 0x111111 }; ThreeDScatterChart c = new ThreeDScatterChart(640, 480); for (int k = 0; k < cltr; k++) { RanSeries r = new RanSeries(k); Double[] xData = new Double[1]; Double[] yData = new Double[1]; Double[] zData = new Double[1]; xData = r.getSeries2(1, V[k, 0], 0, 0); yData = r.getSeries2(1, V[k, 1], 0, 0); zData = r.getSeries2(1, V[k, 2], 0, 0); c.addScatterGroup(xData, yData, zData, "", Chart.GlassSphere2Shape, 18, chartColor[k]); if (viewFuzzyBtn.Visible == true) { for (int i = 0; i < num / 2; i++) { if (custCltr[i] == k) { xData = r.getSeries2(1, X[i, 0], 0, 0); yData = r.getSeries2(1, X[i, 1], 0, 0); zData = r.getSeries2(1, X[i, 2], 0, 0); c.addScatterGroup(xData, yData, zData, "", Chart.GlassSphere2Shape, 12, chartColor[k]); } } c.addScatterGroup(xData, yData, zData, rfmv[k], Chart.GlassSphere2Shape, 12, chartColor[k]); c.addLegend(400, 10); } else { for (int i = 0; i < num / 2; i++) { if (custCltr[i] == k) { xData = r.getSeries2(1, X[i, 0] * temp10, 0, 0); yData = r.getSeries2(1, X[i, 1] * temp10, 0, 0); zData = r.getSeries2(1, X[i, 2] * temp10, 0, 0); c.addScatterGroup(xData, yData, zData, "", Chart.GlassSphere2Shape, 12, chartColor[k]); } } } } c.setPlotRegion(350, 225, 360, 360, 270); c.setViewAngle(15, 30); c.xAxis().setTitle("Recency"); c.yAxis().setTitle("Frequency"); c.zAxis().setTitle("Monetary"); viewer.Chart = c; viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='(x={x|p}, y={y|p}, z={z|p}'"); }
private void BuildChart(WinChartViewer winChartViewerResult, string[] titleXYZ, int chooseItem) { //Налаштування графіку // Create a ThreeDScatterChart object of size ThreeDScatterChart c = new ThreeDScatterChart(750, 550); // Add a title to the chart c.addTitle("3D Scatter Groups", "Times New Roman Italic", 14); // Set the center of the plot region at (350, 240), //and set width x depth x height to last three parameters c.setPlotRegion(300, 240, 350, 350, 350); // Set the elevation and rotation angles to 15 and 30 degrees c.setViewAngle(15, 30); // Add a legend box at c.addLegend(650, 20); MethodOperation methodOperation = GetDelegateOperation(chooseItem); double[] x; double[] y; double[] z; //Додавання группи для графіку по назві проекту foreach (KeyValuePair <string, List <BestResultGA> > group in _resultGAByNameProjectGroup) { //розмір групи int countElementsInGroup = group.Value.Count; x = new double[countElementsInGroup]; y = new double[countElementsInGroup]; z = new double[countElementsInGroup]; int i = 0; //наповнити групу methodOperation(group.Value, ref x, ref y, ref z, ref i); //добавити групу точок c.addScatterGroup(x, y, z, group.Key, Chart.GlassSphere2Shape, 10); } // Set the x, y and z axis titles c.xAxis().setTitle(titleXYZ[0]); c.yAxis().setTitle(titleXYZ[1]); c.zAxis().setTitle(titleXYZ[2]); // Output the chart winChartViewerResult.Chart = c; winChartViewerResult.ImageMap = c.getHTMLImageMap("chart");//, "", "x={x}&y={y}&z={z}&dataSet={dataSet}&dataSetName={name}"); // winChartViewerResult.ClickHotSpot += WinChartViewerResult_ClickHotSpot; //Зберегти графік в зображення //c.makeChart("chart.png"); }
//Main code for creating chart. //Note: the argument chartIndex is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, int chartIndex) { // The XYZ data for the 3D scatter chart as 3 random data series RanSeries r = new RanSeries(3); double[] xData = r.getSeries2(20, 100, -10, 10); double[] yData = r.getSeries2(20, 100, -10, 10); double[] zData = r.getSeries2(20, 100, -10, 10); // Create a ThreeDScatterChart object of size 720 x 520 pixels ThreeDScatterChart c = new ThreeDScatterChart(720, 520); // Add a title to the chart using 20 points Times New Roman Italic font c.addTitle("3D Scatter Chart (2) ", "Times New Roman Italic", 20); // Set the center of the plot region at (350, 240), and set width x depth x height to // 360 x 360 x 270 pixels c.setPlotRegion(350, 240, 360, 360, 270); // Set the elevation and rotation angles to 15 and 30 degrees c.setViewAngle(15, 30); // Add a scatter group to the chart using 13 pixels glass sphere symbols, in which the // color depends on the z value of the symbol ThreeDScatterGroup g = c.addScatterGroup(xData, yData, zData, "", Chart.GlassSphere2Shape, 13, Chart.SameAsMainColor); // Add grey (888888) drop lines to the symbols g.setDropLine(0x888888); // Add a color axis (the legend) in which the left center is anchored at (645, 220). Set // the length to 200 pixels and the labels on the right side. Use smooth gradient // coloring. c.setColorAxis(645, 220, Chart.Left, 200, Chart.Right).setColorGradient(); // Set the x, y and z axis titles using 10 points Arial Bold font c.xAxis().setTitle("X-Axis Place Holder", "Arial Bold", 10); c.yAxis().setTitle("Y-Axis Place Holder", "Arial Bold", 10); c.zAxis().setTitle("Z-Axis Place Holder", "Arial Bold", 10); // Output the chart viewer.Chart = c; //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='(x={x|p}, y={y|p}, z={z|p}'"); }
//Main code for creating chart. //Note: the argument chartIndex is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, int chartIndex, int minvalue, int maxvalue) { double[] xData = { minvalue }; double[] yData = { minvalue }; double[] zData = { minvalue }; double[] xData2 = { maxvalue }; double[] yData2 = { maxvalue }; double[] zData2 = { maxvalue }; // Create a ThreeDScatterChart object of size 720 x 600 pixels ThreeDScatterChart c = new ThreeDScatterChart(720, 600); // Add a title to the chart using 20 points Times New Roman Italic font c.addTitle("3D Scatter Chart (1) ", "Times New Roman Italic", 20); // Set the center of the plot region at (350, 280), and set width x depth x height to // 360 x 360 x 270 pixels c.setPlotRegion(350, 280, 360, 360, 270); // Add a scatter group to the chart using 11 pixels glass sphere symbols, in which the // color depends on the z value of the symbol c.addScatterGroup(xData, yData, zData, "", Chart.GlassSphere2Shape, 0, Chart.DataColor); c.addScatterGroup(xData2, yData2, zData2, "", Chart.GlassSphere2Shape, 0, Chart.DataColor); for (int i = 0; i < AP.Count; i++) { c.addScatterGroup(AP[i].Xd, AP[i].Yd, AP[i].Zd, "", Chart.GlassSphere2Shape, 5, Chart.DataColor); } // Add a color axis (the legend) in which the left center is anchored at (645, 270). Set // the length to 200 pixels and the labels on the right side. // c.setColorAxis(645, 270, Chart.Left, 200, Chart.Right); // Set the x, y and z axis titles using 10 points Arial Bold font c.xAxis().setTitle("X-Axis Place Holder", "Arial Bold", 10); c.yAxis().setTitle("Y-Axis Place Holder", "Arial Bold", 10); c.zAxis().setTitle("Z-Axis Place Holder", "Arial Bold", 10); // Output the chart viewer.Chart = c; //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='(x={x|p}, y={y|p}, z={z|p}'"); }
// // Create chart // private void createChart(RazorChartViewer viewer) { // The XYZ data for the 3D scatter chart as 3 random data series RanSeries r = new RanSeries(0); double[] xData = r.getSeries2(100, 100, -10, 10); double[] yData = r.getSeries2(100, 0, 0, 20); double[] zData = r.getSeries2(100, 100, -10, 10); // Create a ThreeDScatterChart object of size 720 x 600 pixels ThreeDScatterChart c = new ThreeDScatterChart(720, 600); // Add a title to the chart using 20 points Times New Roman Italic font c.addTitle("3D Scatter Chart (1) ", "Times New Roman Italic", 20); // Set the center of the plot region at (350, 280), and set width x depth x height to 360 x // 360 x 270 pixels c.setPlotRegion(350, 280, 360, 360, 270); // Add a scatter group to the chart using 11 pixels glass sphere symbols, in which the color // depends on the z value of the symbol c.addScatterGroup(xData, yData, zData, "", Chart.GlassSphere2Shape, 11, Chart.SameAsMainColor ); // Add a color axis (the legend) in which the left center is anchored at (645, 270). Set the // length to 200 pixels and the labels on the right side. c.setColorAxis(645, 270, Chart.Left, 200, Chart.Right); // Set the x, y and z axis titles using 10 points Arial Bold font c.xAxis().setTitle("X-Axis Place Holder", "Arial Bold", 10); c.yAxis().setTitle("Y-Axis Place Holder", "Arial Bold", 10); c.zAxis().setTitle("Z-Axis Place Holder", "Arial Bold", 10); // Output the chart viewer.Image = c.makeWebImage(Chart.PNG); // Include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("", "", "title='(x={x|p}, y={y|p}, z={z|p}'"); }
//Main code for creating chart. //Note: the argument chartIndex is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, int chartIndex, int minvalue, int maxvalue) { ThreeDScatterChart c = new ThreeDScatterChart(1188, 757); //전체 크기수정(하얀부분) winchart = viewer; min = minvalue; //좌표값의 최소값, 최대값을 정할수있게 만들어뒀습니다. max = maxvalue; double[] xData1 = { minvalue, minvalue, minvalue, minvalue }; double[] yData1 = { minvalue, minvalue, minvalue, minvalue }; double[] zData1 = { minvalue, minvalue, minvalue, minvalue }; double[] xData2 = { maxvalue, maxvalue, maxvalue, maxvalue }; double[] yData2 = { maxvalue, maxvalue, maxvalue, maxvalue }; double[] zData2 = { maxvalue, maxvalue, maxvalue, maxvalue }; // 필독=========================================== // // 데이터는 세로방향으로 점하나씩 만들어지게 되있습니다. 한마디로 double[] 하나당 점이 4개씩찍히니 값을 일치시켜주는게 좋습니다. // //================================================ c.addTitle("Data Visualization", "Times New Roman", 12); // 제목, 폰트, 크기 // Set the center of the plot region at (350, 240), and set width x depth x height to // 360 x 360 x 270 pixels c.setPlotRegion(600, 300, 600, 600, 350); //이것을 이용해서 그래프의 크기를 조절할수있습니다. c.setBackground(0xffffff, 0x000000); c.setViewAngle(15, 30); // 보는각도입니다. ThreeDScatterGroup g = c.addScatterGroup(xData1, yData1, zData1, "", Chart.GlassSphere2Shape, 0, Chart.SameAsMainColor); c.addScatterGroup(xData2, yData2, zData2, "", Chart.GlassSphere2Shape, 0, Chart.SameAsMainColor); // 점 추가시키는부분 //g 없어도 잘돌아갑니다. for (int i = 0; i < PL.Count(); i++) { c.addScatterGroup(PL[i].Xd, PL[i].Yd, PL[i].Zd, "", Chart.GlassSphere2Shape, 10, Chart.SameAsMainColor); }//좌표를 추가하면 List에 저장되서 새로그리는것 //GlassSphere2Shape // Add grey (888888) drop lines to the symbols g.setDropLine(0x888888); //뭔지모름 없어도잘돌아감 // Add a color axis (the legend) in which the left center is anchored at (645, 220). Set // the length to 200 pixels and the labels on the right side. Use smooth gradient // coloring. // Set the x, y and z axis titles using 10 points Arial Bold font c.xAxis().setTitle("X-Axis Place Holder", "Arial Bold", 10); c.yAxis().setTitle("Y-Axis Place Holder", "Arial Bold", 10); c.zAxis().setTitle("Z-Axis Place Holder", "Arial Bold", 10); c.xAxis().setColors(0xffffff, 0x000000); c.yAxis().setColors(0xffffff, 0x000000); c.zAxis().setColors(0xffffff, 0x000000); // Output the chart viewer.Chart = c; //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='(x={x|p}, y={y|p}, z={z|p})'"); }
//Main code for creating chart. //Note: the argument chartIndex is unused because this demo only has 1 chart. public void createChart(WinChartViewer viewer, SizeF scale) { this.viewer = viewer; this.scale = scale; // The XYZ data for the 3D scatter chart as 3 random data series // Create a ThreeDScatterChart object c = new ThreeDScatterChart( Convert.ToInt32(424 * scale.Width), Convert.ToInt32(352 * scale.Height) ); c.setBackground(725538, 725538, 0);//7913160 jasny niebieski 725538 ciemny float labelFontSize = 9 * scale.Height; c.xAxis().setLabelStyle("Arial Bold", labelFontSize, 7913160); c.yAxis().setLabelStyle("Arial Bold", labelFontSize, 7913160); c.zAxis().setLabelStyle("Arial Bold", labelFontSize, 7913160); // Add a title to the chart using 20 points Times New Roman Italic font c.addTitle(" ", "Calibri", labelFontSize * 2, 7913160); // Set the center of the plot region at (350, 280), and set width x depth x height to // 360 x 360 x 270 pixels //c.setPlotRegion(212, 176, 180, 180, 135); c.setPlotRegion( Convert.ToInt32(212 * scale.Width), Convert.ToInt32(176 * scale.Height), Convert.ToInt32(180 * scale.Height), Convert.ToInt32(180 * scale.Height), Convert.ToInt32(135 * scale.Height) ); // Color palette for the legend //int[] color_palette = new int[] { 15754320, 14643553, 13532786, 12422019, 11245461, 10134694, 9023927, 7913160 }; //inverted int[] color_palette = new int[] { 2461197, 9029689, 16638029, 16621366, 16736768 }; // Add a scatter group to the chart using 11 pixels glass sphere symbols, in which the // color depends on the z value of the symbol c.addScatterGroup(xData, yData, zData, "", Chart.GlassSphere2Shape, 11, Chart.SameAsMainColor); //TODO: //Set the point color by the wind speed // Wall thicknes, wall color, wall grid c.setWallThickness(1, 1, 1); c.setWallColor(725538, 725538, 725538); c.setWallGrid(7913160, 7913160, 7913160); // Add a color axis (the legend) in which the left center is anchored at (645, 270). Set // the length to 200 pixels and the labels on the right side. // Set the colors of the axis elements c.setColorAxis( Convert.ToInt32(370 * scale.Width), Convert.ToInt32(175 * scale.Height), Chart.Left, 100, Chart.Right ).setColors(725538, 7913160, 7913160, 7913160); //set gradient to true and the color palette for the color axis, c.colorAxis().setColorGradient(true, color_palette); // Set the x, y and z axis titles using 10 points Arial Bold font c.xAxis().setTitle("Longitude", "Calibri", labelFontSize, 7913160); c.yAxis().setTitle("Latitude", "Calibri", labelFontSize, 7913160); c.zAxis().setTitle("Altitude", "Calibri", labelFontSize, 7913160); // Output the chart viewer.Chart = c; //include tool tip for the chart viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='(x={x|p}, y={y|p}, z={z|p}'"); }