private void Window_Loaded(object sender, RoutedEventArgs e) { // Data for the chart as 3 random data series RanSeries r = new RanSeries(127); double[] data0 = r.getSeries(100, 100, -15, 15); double[] data1 = r.getSeries(100, 150, -15, 15); double[] data2 = r.getSeries(100, 200, -15, 15); DateTime[] timeStamps = r.getDateSeries(100, new DateTime(2011, 1, 1), 86400); // Create a XYChart object of size 640 x 400 pixels XYChart c = new XYChart(640, 400); // Add a title to the chart using 18pt Times New Roman Bold Italic font c.addTitle(" Product Line Global Revenue", "Times New Roman Bold Italic", 18); // Set the plotarea at (50, 55) with width 70 pixels less than chart width, and height 90 pixels // less than chart height. Use a vertical gradient from light blue (f0f6ff) to sky blue (a0c0ff) // as background. Set border to transparent and grid lines to white (ffffff). c.setPlotArea(50, 55, c.getWidth() - 70, c.getHeight() - 90, c.linearGradientColor(0, 55, 0, c.getHeight() - 35, 0xf0f6ff, 0xa0c0ff), -1, Chart.Transparent, 0xffffff, 0xffffff); // Set legend icon style to use line style icon, sized for 8pt font c.getLegend().setLineStyleKey(); c.getLegend().setFontSize(8); // Set axis label style to 8pt Arial Bold c.xAxis().setLabelStyle("Arial Bold", 8); c.yAxis().setLabelStyle("Arial Bold", 8); // Set the axis stem to transparent c.xAxis().setColors(Chart.Transparent); c.yAxis().setColors(Chart.Transparent); // Configure x-axis label format c.xAxis().setMultiFormat(Chart.StartOfYearFilter(), "{value|mm/yyyy} ", Chart.StartOfMonthFilter( ), "{value|mm}"); // Add axis title using 10pt Arial Bold Italic font c.yAxis().setTitle("USD millions", "Arial Bold Italic", 10); // Add a line layer to the chart using a line width of 2 pixels. LineLayer layer = c.addLineLayer2(); layer.setLineWidth(2); // Add 3 data series to the line layer layer.setXData(timeStamps); layer.addDataSet(data0, 0xff3333, "Alpha"); layer.addDataSet(data1, 0x008800, "Beta"); layer.addDataSet(data2, 0x3333cc, "Gamma"); // Include track line with legend for the latest data values trackLineLegend(c, c.getPlotArea().getRightX()); // Assign the chart to the WPFChartViewer WPFChartViewer1.Chart = c; }
// // Draw the chart. // private void drawChart(WPFChartViewer viewer) { // Get the start date and end date that are visible on the chart. DateTime viewPortStartDate = Chart.NTime(viewer.getValueAtViewPort("x", viewer.ViewPortLeft)); DateTime viewPortEndDate = Chart.NTime(viewer.getValueAtViewPort("x", viewer.ViewPortLeft + viewer.ViewPortWidth)); // Get the array indexes that corresponds to the visible start and end dates int startIndex = (int)Math.Floor(Chart.bSearch(timeStamps, viewPortStartDate)); int endIndex = (int)Math.Ceiling(Chart.bSearch(timeStamps, viewPortEndDate)); int noOfPoints = endIndex - startIndex + 1; // Extract the part of the data array that are visible. DateTime[] viewPortTimeStamps = (DateTime[])Chart.arraySlice(timeStamps, startIndex, noOfPoints); double[] viewPortDataSeriesA = (double[])Chart.arraySlice(dataSeriesA, startIndex, noOfPoints); double[] viewPortDataSeriesB = (double[])Chart.arraySlice(dataSeriesB, startIndex, noOfPoints); double[] viewPortDataSeriesC = (double[])Chart.arraySlice(dataSeriesC, startIndex, noOfPoints); // // At this stage, we have extracted the visible data. We can use those data to plot the chart. // //================================================================================ // Configure overall chart appearance. //================================================================================ // Create an XYChart object of size 640 x 400 pixels XYChart c = new XYChart(640, 400); // Set the plotarea at (55, 55) with width 80 pixels less than chart width, and height 90 pixels // less than chart height. Use a vertical gradient from light blue (f0f6ff) to sky blue (a0c0ff) // as background. Set border to transparent and grid lines to white (ffffff). c.setPlotArea(55, 55, c.getWidth() - 80, c.getHeight() - 90, c.linearGradientColor(0, 55, 0, c.getHeight() - 35, 0xf0f6ff, 0xa0c0ff), -1, Chart.Transparent, 0xffffff, 0xffffff); // As the data can lie outside the plotarea in a zoomed chart, we need enable clipping. c.setClipping(); // Add a title to the chart using 15pt Arial Bold font c.addTitle(" Zooming and Scrolling with Viewport Control", "Arial Bold", 15); // Set legend icon style to use line style icon, sized for 10pt font c.getLegend().setLineStyleKey(); c.getLegend().setFontSize(10); // Set the x and y axis stems to transparent and the label font to 10pt Arial c.xAxis().setColors(Chart.Transparent); c.yAxis().setColors(Chart.Transparent); c.xAxis().setLabelStyle("Arial", 10); c.yAxis().setLabelStyle("Arial", 10); // Add axis title using 10pt Arial Bold font c.yAxis().setTitle("Ionic Temperature (C)", "Arial Bold", 10); //================================================================================ // Add data to chart //================================================================================ // // In this example, we represent the data by lines. You may modify the code below to use other // representations (areas, scatter plot, etc). // // Add a line layer for the lines, using a line width of 2 pixels LineLayer layer = c.addLineLayer2(); layer.setLineWidth(2); // In this demo, we do not have too many data points. In real code, the chart may contain a lot // of data points when fully zoomed out - much more than the number of horizontal pixels in this // plot area. So it is a good idea to use fast line mode. layer.setFastLineMode(); // Now we add the 3 data series to a line layer, using the color red (ff33333), green (008800) // and blue (3333cc) layer.setXData(viewPortTimeStamps); layer.addDataSet(viewPortDataSeriesA, 0xff3333, "Alpha"); layer.addDataSet(viewPortDataSeriesB, 0x008800, "Beta"); layer.addDataSet(viewPortDataSeriesC, 0x3333cc, "Gamma"); //================================================================================ // Configure axis scale and labelling //================================================================================ // Set the x-axis as a date/time axis with the scale according to the view port x range. viewer.syncDateAxisWithViewPort("x", c.xAxis()); // For the automatic y-axis labels, set the minimum spacing to 30 pixels. c.yAxis().setTickDensity(30); // // In this demo, the time range can be from a few years to a few days. We demonstrate how to set // up different date/time format based on the time range. // // If all ticks are yearly aligned, then we use "yyyy" as the label format. c.xAxis().setFormatCondition("align", 360 * 86400); c.xAxis().setLabelFormat("{value|yyyy}"); // If all ticks are monthly aligned, then we use "mmm yyyy" in bold font as the first label of a // year, and "mmm" for other labels. c.xAxis().setFormatCondition("align", 30 * 86400); c.xAxis().setMultiFormat(Chart.StartOfYearFilter(), "<*font=bold*>{value|mmm<*br*>yyyy}", Chart.AllPassFilter(), "{value|mmm}"); // If all ticks are daily algined, then we use "mmm dd<*br*>yyyy" in bold font as the first // label of a year, and "mmm dd" in bold font as the first label of a month, and "dd" for other // labels. c.xAxis().setFormatCondition("align", 86400); c.xAxis().setMultiFormat(Chart.StartOfYearFilter(), "<*block,halign=left*><*font=bold*>{value|mmm dd<*br*>yyyy}", Chart.StartOfMonthFilter(), "<*font=bold*>{value|mmm dd}"); c.xAxis().setMultiFormat2(Chart.AllPassFilter(), "{value|dd}"); // For all other cases (sub-daily ticks), use "hh:nn<*br*>mmm dd" for the first label of a day, // and "hh:nn" for other labels. c.xAxis().setFormatCondition("else"); c.xAxis().setMultiFormat(Chart.StartOfDayFilter(), "<*font=bold*>{value|hh:nn<*br*>mmm dd}", Chart.AllPassFilter(), "{value|hh:nn}"); //================================================================================ // Output the chart //================================================================================ // We need to update the track line too. If the mouse is moving on the chart (eg. if // the user drags the mouse on the chart to scroll it), the track line will be updated // in the MouseMovePlotArea event. Otherwise, we need to update the track line here. if (!viewer.IsInMouseMoveEvent) { trackLineLegend(c, (null == viewer.Chart) ? c.getPlotArea().getRightX() : viewer.PlotAreaMouseX); } viewer.Chart = c; }
private void drawChart(WinChartViewer viewer) { // get the start index that are visible on the chart double viewPortStartIndex = viewer.getValueAtViewPort("x", viewer.ViewPortLeft); double viewPortEndIndex = viewer.getValueAtViewPort("x", viewer.ViewPortLeft + viewer.ViewPortWidth); // Get the array indexes that corresponds to the visible start and end int startIndex = (int)Math.Floor(Chart.bSearch(index, viewPortStartIndex)); int endIndex = (int)Math.Ceiling(Chart.bSearch(index, viewPortEndIndex)); Console.WriteLine("port start: " + viewPortStartIndex + " port end: " + viewPortEndIndex + " start: " + startIndex + " end: " + endIndex + " index length: " + index.Length); int noOfPoints = endIndex - startIndex + 1; // declaration the data set double[] viewPortDataSeriesCpu; double[] viewPortDataSeriesGpu; double[] viewPortDataSeriesFps; double[] viewPortDataSeriesCmd; double[] viewPortDataSeriesObj; double[] viewPortDataSeriesTriangle; double[] viewPortDataSeriesDrawTime; double[] viewPortDataSeriesDataSize; double[] viewPortDataSeriesIbLock; double[] viewPortDataSeriesIbSize; double[] viewPortDataSeriesVbLock; double[] viewPortDataSeriesVbSize; double[] viewPortDataSeriesParamSize; double[] viewPortDataSeriesRemoteParamSize; double[] viewPortDataSeriesSurLock; double[] viewPortDataSeriesSurSize; double[] viewPortDataSeriesTexLock; double[] viewPortDataSeriesTexSize; double[] viewPortDataSeriesSetTexture; double[] viewPortDataSeriesStateBlock; double[] viewPortDataSeriesVShaderCmd; double[] viewPortDataSeriesVShaderConst; double[] viewPortDataSeriesPShaderCmd; double[] viewPortDataSeriesPShaderConst; double[] viewPortIndex = (double[])Chart.arraySlice(index, startIndex, noOfPoints); if (this.showCpu) { viewPortDataSeriesCpu = (double[])Chart.arraySlice(cpu, startIndex, noOfPoints); } if (this.showGpu) { viewPortDataSeriesGpu = (double[])Chart.arraySlice(gpu, startIndex, noOfPoints); } if (this.showFps) { viewPortDataSeriesFps = (double[])Chart.arraySlice(fps, startIndex, noOfPoints); } if (this.showCmd) { viewPortDataSeriesCmd = (double[])Chart.arraySlice(cmd, startIndex, noOfPoints); } if (this.showObj) { viewPortDataSeriesObj = (double[])Chart.arraySlice(obj, startIndex, noOfPoints); } if (this.showTriangle) { viewPortDataSeriesTriangle = (double[])Chart.arraySlice(triangle, startIndex, noOfPoints); } if (this.showDrawTime) { viewPortDataSeriesDrawTime = (double[])Chart.arraySlice(draw, startIndex, noOfPoints); } if (this.showDataSize) { viewPortDataSeriesDataSize = (double[])Chart.arraySlice(data, startIndex, noOfPoints); } if (this.showIbLock) { viewPortDataSeriesIbLock = (double[])Chart.arraySlice(ibLock, startIndex, noOfPoints); } if (this.showIbSize) { viewPortDataSeriesIbSize = (double[])Chart.arraySlice(ibSize, startIndex, noOfPoints); } if (this.showVbLock) { viewPortDataSeriesVbLock = (double[])Chart.arraySlice(vbLock, startIndex, noOfPoints); } if (this.showVbSize) { viewPortDataSeriesVbSize = (double[])Chart.arraySlice(vbSize, startIndex, noOfPoints); } if (this.showParamSize) { viewPortDataSeriesParamSize = (double[])Chart.arraySlice(parameterSize, startIndex, noOfPoints); } if (this.showRemoteParamSize) { viewPortDataSeriesRemoteParamSize = (double[])Chart.arraySlice(remoteParamSize, startIndex, noOfPoints); } if (this.showSurLock) { viewPortDataSeriesSurLock = (double[])Chart.arraySlice(surLock, startIndex, noOfPoints); } if (this.showSurSize) { viewPortDataSeriesSurSize = (double[])Chart.arraySlice(surSize, startIndex, noOfPoints); } if (this.showTexLock) { viewPortDataSeriesTexLock = (double[])Chart.arraySlice(texLock, startIndex, noOfPoints); } if (this.showTexSize) { viewPortDataSeriesTexSize = (double[])Chart.arraySlice(texSize, startIndex, noOfPoints); } if (this.showSetTexTime) { viewPortDataSeriesSetTexture = (double[])Chart.arraySlice(setTex, startIndex, noOfPoints); } if (this.showStateBlock) { viewPortDataSeriesStateBlock = (double[])Chart.arraySlice(stateBlock, startIndex, noOfPoints); } if (this.showVShaderCmd) { viewPortDataSeriesVShaderCmd = (double[])Chart.arraySlice(vShaderCmd, startIndex, noOfPoints); } if (this.showVShaderConst) { viewPortDataSeriesVShaderConst = (double[])Chart.arraySlice(vShaderConst, startIndex, noOfPoints); } if (this.showPShaderCmd) { viewPortDataSeriesPShaderCmd = (double[])Chart.arraySlice(pShaderCmd, startIndex, noOfPoints); } if (this.showPShaderConst) { viewPortDataSeriesPShaderConst = (double[])Chart.arraySlice(pShaderConst, startIndex, noOfPoints); } // configure overall chart apperance XYChart c = new XYChart(820, 490); c.setPlotArea(55, 50, c.getWidth() - 80, c.getHeight() - 85, c.linearGradientColor(0, 50, 0, c.getHeight() - 35, 0xf0f6ff, 0xa0c0ff), -1, Chart.Transparent, 0xffffff, 0xfffff); c.setClipping(); c.addTitle(" All charactor for game", "Times New Roman Bold Italic", 10); // Set legend icon style to use line style icon, sized for 8pt font c.getLegend().setLineStyleKey(); c.getLegend().setFontSize(8); //LegendBox b = c.addLegend(55, 25, false, "Arial Bold", 8); //b.setBackground(Chart.Transparent); //b.setLineStyleKey(); // set the axis stem to transparent c.xAxis().setColors(Chart.Transparent); c.yAxis().setColors(Chart.Transparent); // add the y axixs title c.yAxis().setTitle("chractor", "Arial Bold Italic", 10); // add data to chart LineLayer layer = c.addLineLayer2(); layer.setLineWidth(2); layer.setFastLineMode(); layer.setXData(this.index); /* * layer.addDataSet(viewPortDataSeriesCpu, 0xff3333, "CPU"); * layer.addDataSet(viewPortDataSeriesGpu, 0x008800, "GPU"); * layer.addDataSet(viewPortDataSeriesFps, 0x3333cc, "FPS"); */ if (this.showCpu) { layer.addDataSet(cpu, 0xff3333, "CPU"); } if (this.showGpu) { layer.addDataSet(gpu, 0x008800, "GPU"); } if (this.showFps) { layer.addDataSet(fps, 0x3333cc, "FPS"); } if (this.showCmd) { layer.addDataSet(cmd, 0x3388cc, "CMD"); } if (this.showObj) { layer.addDataSet(obj, 0x8833cc, "OBJ"); } if (this.showTriangle) { layer.addDataSet(triangle, 0x333388, "TRI"); } if (this.showDrawTime) { layer.addDataSet(draw, 0xff0000, "DRAW"); } if (this.showDataSize) { layer.addDataSet(data, 0xff00cc, "DATA"); } if (this.showIbLock) { layer.addDataSet(ibLock, 0x8888cc, "IBLOCK"); } if (this.showIbSize) { layer.addDataSet(ibSize, 0x8833cc, "IBSIZE"); } if (this.showVbLock) { layer.addDataSet(vbLock, 0x3333cc, "VBLOCK"); } if (this.showVbSize) { layer.addDataSet(vbSize, 0x3333cc, "VBSIZE"); } if (this.showParamSize) { layer.addDataSet(parameterSize, 0x3333cc, "PARAM"); } if (this.showRemoteParamSize) { layer.addDataSet(remoteParamSize, 0x3333cc, "REMOTE"); } if (this.showSurLock) { layer.addDataSet(surLock, 0x3333cc, "SURLOCK"); } if (this.showSurSize) { layer.addDataSet(surSize, 0x3333cc, "SURSIZE"); } if (this.showTexLock) { layer.addDataSet(texLock, 0x3333cc, "TEXLOCK"); } if (this.showTexSize) { layer.addDataSet(texSize, 0x3333cc, "TEXSIZE"); } if (this.showSetTexTime) { layer.addDataSet(setTex, 0x3333cc, "SETTEX"); } if (this.showStateBlock) { layer.addDataSet(stateBlock, 0x3333cc, "STATEBLOCK"); } if (this.showVShaderCmd) { layer.addDataSet(vShaderCmd, 0x3333cc, "VSC"); } if (this.showVShaderConst) { layer.addDataSet(vShaderConst, 0x3333cc, "VSCONST"); } if (this.showPShaderCmd) { layer.addDataSet(pShaderCmd, 0x3333cc, "PSC"); } if (this.showPShaderConst) { layer.addDataSet(pShaderConst, 0x3333cc, "PSCONST"); } // configure the axis scale and labeling //viewer.syncDateAxisWithViewPort("x", c.xAxis()); viewer.syncLinearAxisWithViewPort("x", c.xAxis()); // If all ticks are yearly aligned, then we use "yyyy" as the label format. //c.xAxis().setFormatCondition("align", 32); //c.xAxis().setLabelFormat("{value|p4}"); viewer.Chart = c; }
// // Draw the chart and display it in the given viewer. // private void drawChart(WinChartViewer viewer) { // Create an XYChart object 600 x 270 pixels in size, with light grey (f4f4f4) // background, black (000000) border, 1 pixel raised effect, and with a rounded frame. XYChart c = new XYChart(600, 270, 0xf4f4f4, 0x000000, 1); c.setRoundedFrame(Chart.CColor(BackColor)); // Set the plotarea at (55, 55) and of size 520 x 185 pixels. Use white (ffffff) // background. Enable both horizontal and vertical grids by setting their colors to // grey (cccccc). Set clipping mode to clip the data lines to the plot area. c.setPlotArea(55, 55, 520, 185, 0xffffff, -1, -1, 0xcccccc, 0xcccccc); c.setClipping(); // Add a title to the chart using 15 pts Times New Roman Bold Italic font, with a light // grey (dddddd) background, black (000000) border, and a glass like raised effect. c.addTitle("Field Intensity at Observation Satellite", "Times New Roman Bold Italic", 15 ).setBackground(0xdddddd, 0x000000, Chart.glassEffect()); // Set the reference font size of the legend box c.getLegend().setFontSize(8); // Configure the y-axis with a 10pts Arial Bold axis title c.yAxis().setTitle("Intensity (V/m)", "Arial Bold", 10); // Configure the x-axis to auto-scale with at least 75 pixels between major tick and 15 // pixels between minor ticks. This shows more minor grid lines on the chart. c.xAxis().setTickDensity(75, 15); // Set the axes width to 2 pixels c.xAxis().setWidth(2); c.yAxis().setWidth(2); // Now we add the data to the chart DateTime firstTime = timeStamps[0]; if (firstTime != DateTime.MinValue) { // Set up the x-axis scale. In this demo, we set the x-axis to show the 240 samples, // with 250ms per sample. c.xAxis().setDateScale(firstTime, firstTime.AddSeconds( dataRateTimer.Interval * timeStamps.Length / 1000)); // Set the x-axis label format c.xAxis().setLabelFormat("{value|hh:nn:ss}"); // Create a line layer to plot the lines LineLayer layer = c.addLineLayer2(); // The x-coordinates are the timeStamps. layer.setXData(timeStamps); // The 3 data series are used to draw 3 lines. layer.addDataSet(dataSeriesA, 0xff0000, "Alpha"); layer.addDataSet(dataSeriesB, 0x00cc00, "Beta"); layer.addDataSet(dataSeriesC, 0x0000ff, "Gamma"); } // Include track line with legend. If the mouse is on the plot area, show the track // line with legend at the mouse position; otherwise, show them for the latest data // values (that is, at the rightmost position). trackLineLegend(c, viewer.IsMouseOnPlotArea ? viewer.PlotAreaMouseX : c.getPlotArea().getRightX()); // Assign the chart to the WinChartViewer viewer.Chart = c; }
private void drawChart(WinChartViewer viewer) { // get the start index that are visible on the chart double viewPortStartIndex = viewer.getValueAtViewPort("x", viewer.ViewPortLeft); double viewPortEndIndex = viewer.getValueAtViewPort("x", viewer.ViewPortLeft + viewer.ViewPortWidth); // Get the array indexes that corresponds to the visible start and end int startIndex = 0; int endIndex = 0; if (showInFrame) { startIndex = (int)Math.Floor(Chart.bSearch(indexForFrame, viewPortStartIndex)); endIndex = (int)Math.Ceiling(Chart.bSearch(indexForFrame, viewPortEndIndex)); Console.WriteLine("port start: " + viewPortStartIndex + " port end: " + viewPortEndIndex + " start: " + startIndex + " end: " + endIndex + " index length: " + indexForFrame.Length); } else { startIndex = (int)Math.Floor(Chart.bSearch(indexForSecond, viewPortStartIndex)); endIndex = (int)Math.Ceiling(Chart.bSearch(indexForSecond, viewPortEndIndex)); Console.WriteLine("port start: " + viewPortStartIndex + " port end: " + viewPortEndIndex + " start: " + startIndex + " end: " + endIndex + " index length: " + indexForSecond.Length); } int noOfPoints = endIndex - startIndex + 1; // declaration the data set double[] viewPortDataSeriesCpuInFrame; double[] viewPortDataSeriesGpuInFrame; double[] viewPortDataSeriesFpsInFrame; double[] viewPortDataSeriesFpsInSecond; double[] viewPortDataSeriesCpuInSecond; double[] viewPortDataSeriesGpuInSecond; double[] viewPortIndex; if (showInFrame) { viewPortIndex = (double[])Chart.arraySlice(indexForFrame, startIndex, noOfPoints); if (this.showCpu) { viewPortDataSeriesCpuInFrame = (double[])Chart.arraySlice(cpuInFrame, startIndex, noOfPoints); } if (this.showGpu) { viewPortDataSeriesGpuInFrame = (double[])Chart.arraySlice(gpuInFrame, startIndex, noOfPoints); } if (this.showFps) { viewPortDataSeriesFpsInFrame = (double[])Chart.arraySlice(fpsInFrame, startIndex, noOfPoints); } } else { viewPortIndex = (double[])Chart.arraySlice(indexForSecond, startIndex, noOfPoints); if (this.showCpu) { viewPortDataSeriesCpuInSecond = (double[])Chart.arraySlice(cpuInSecond, startIndex, noOfPoints); } if (this.showGpu) { viewPortDataSeriesGpuInSecond = (double[])Chart.arraySlice(gpuInSecond, startIndex, noOfPoints); } if (this.showFps) { viewPortDataSeriesFpsInSecond = (double[])Chart.arraySlice(fpsInSecond, startIndex, noOfPoints); } } // configure overall chart apperance XYChart c = new XYChart(807, 371); c.setPlotArea(55, 50, c.getWidth() - 80, c.getHeight() - 85, c.linearGradientColor(0, 50, 0, c.getHeight() - 35, 0xf0f6ff, 0xa0c0ff), -1, Chart.Transparent, 0xffffff, 0xfffff); c.setClipping(); c.addTitle("Charactor for game", "Times New Roman Bold Italic", 10); // Set legend icon style to use line style icon, sized for 8pt font c.getLegend().setLineStyleKey(); c.getLegend().setFontSize(8); //LegendBox b = c.addLegend(55, 25, false, "Arial Bold", 8); //b.setBackground(Chart.Transparent); //b.setLineStyleKey(); // set the axis stem to transparent c.xAxis().setColors(Chart.Transparent); c.yAxis().setColors(Chart.Transparent); // add the y axixs title c.yAxis().setTitle("chractor", "Arial Bold Italic", 10); // add data to chart LineLayer layer = c.addLineLayer2(); layer.setLineWidth(2); layer.setFastLineMode(); if (this.showInFrame) { layer.setXData(this.indexForFrame); } else { layer.setXData(this.indexForSecond); } /* * layer.addDataSet(viewPortDataSeriesCpu, 0xff3333, "CPU"); * layer.addDataSet(viewPortDataSeriesGpu, 0x008800, "GPU"); * layer.addDataSet(viewPortDataSeriesFps, 0x3333cc, "FPS"); */ if (this.showInFrame) { if (this.showCpu) { layer.addDataSet(cpuInFrame, 0xff3333, "CPU In Frame"); } if (this.showGpu) { layer.addDataSet(gpuInFrame, 0x008800, "GPU In Frame"); } if (this.showFps) { layer.addDataSet(fpsInFrame, 0xcccccc, "FPS In Frame"); } } else { if (this.showCpu) { layer.addDataSet(cpuInSecond, 0x33cc33, "CPU In Second"); } if (this.showGpu) { layer.addDataSet(gpuInSecond, 0xff8833, "GPU In Second"); } if (this.showFps) { layer.addDataSet(fpsInSecond, 0xcccccc, "FPS In Second"); } } // configure the axis scale and labeling //viewer.syncDateAxisWithViewPort("x", c.xAxis()); viewer.syncLinearAxisWithViewPort("x", c.xAxis()); // If all ticks are yearly aligned, then we use "yyyy" as the label format. //c.xAxis().setFormatCondition("align", 32); //c.xAxis().setLabelFormat("{value|p4}"); viewer.Chart = c; }