![]() ![]() Set the configured brush via graph ->setBrush(.). Fills under graph or between two graphs: All brushes the QPainter-framework provides can be used in graph fills: solid, various patterns, textures, gradients, colors, transparency, etc.If you don't want any scatter symbols to show at the data points, set the graph's scatter style to QCPScatterStyle ::ssNone. For all possible scatter styles, see the QCPScatterStyle documentation or the scatter style demo screenshot shown on the introduction page. Scatter symbol: Call graph ->setScatterStyle(.) to change the look of the scatter point symbols.Set the configured pen via graph ->setPen(.). solid, dashed, dotted, different widths, colors, transparency, etc. ![]() Line pen: All pens the QPainter-framework provides are available, e.g.For all possible line styles, see the QCPGraph ::LineStyle documentation or the line style demo screenshot on the introduction page. Line style: Call graph ->setLineStyle(.).The look of the graph is characterized by many factors, all of which can be modified. Then you can adjust the margin manually via customPlot ->axisRect() ->setMargins(.). It makes the axis rect shrink if the tick labels and axis labels need more space. If you don't wish that the margin is determined automatically, disable the behaviour by calling customPlot ->axisRect() ->setAutoMargins( QCP ::msNone). This is due to the automatic margin calculation, which is turned on by default. The tick labels (the numbers) of the axes never reach outside the widget border, even when they get wider. See the QCPAxisTicker documentation for details. for time spans, calendar dates, categories, pi (or other symbolic units) and logarithmic axes. You can adjust the approximate number of ticks that the ticker tries to create via xAxis ->ticker() ->setTickCount(6). The default axis ticker is well suited for simple numerical displays, however there are specialized classes e.g. This is an instance of type QCPAxisTicker, and is accessible e.g. The tick step and labeling is chosen automatically, by the axis ticker that is currently used by the axis. The output should look something like shown below. Such user interactions are for example dragging the axis ranges with the mouse and zooming with the mouse wheel. Note that a replot will automatically happen when the widget is resized and when the built-in user interactions are triggered. To make any kind of changes to the plot appear on screen, call customPlot ->replot(). Their range defines which portion of the plot is currently visible: customPlot ->xAxis ->setRange(-1, 1). So if you define the left axis as "key axis" and the bottom as "value axis", you can plot a graph that's standing upright on the left of the plot. By default a QCustomPlot widget has four axes: customPlot ->xAxis, yAxis, xAxis2, and yAxis2 of type QCPAxis, corresponding to the bottom, left, top and right axis. The reason why QCustomPlot uses the terminology key and value instead of x and y is to allow more flexibility in assigning which axis has what role. via customPlot ->graph(0) ->setData(.), for example in the form of two QVector for x and y ( key and value). ![]() Then you assign the graph some data points, e.g. You can create a new graph in the plot via customPlot ->addGraph(). If you have promoted a widget in QtCreator, you'll likely access the respective widget via ui->customPlot (or whatever name you gave the widget) instead. The tutorials use customPlot as a pointer to the QCustomPlot instance. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |