Important: Please read the Qt Code of Conduct -

Can I set string values on the x axis with the ability to adjust the number of values something like "setTickCount()"

  • Created a candlestick chart with DateTime values on the x axis.
    As you can see in the picture, you get empty spaces on weekends.

    I created an additional " QLineSeries()".
    On candles on the x axis indexes 0, 1, 2 ...... etc.
    "QLineSeries () "data in "DateTime" format.

    Made invisible:
    x axis of the candle chart and "QLineSeries()".
    creating the
    "QDateTimeAxis() "axis for "QLineSeries()".


    It turned out what you need, there are no empty spaces.

    Can I make it easier by creating string values on the x axis?
    With the ability to adjust the number of displayed values, something like a function "setTickCount()"

    In C#, you can set the caption text along the X-axis.

    int INDEX = 0;
    foreach (DataPoint point in chart1.Series["price"].Points)
       point.AxisLabel = nums[INDEX].ToString();//nums[INDEX] format array DateTime

    English is not my native language, please be sympathetic)

  • I managed to put string values on the x axis(datetime data is converted to a string).
    Created on the x axis QBarCategoryAxis.
    Everything would be fine, but I can't adjust tick marks on the axis.

Log in to reply