Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    General and Desktop
    1
    2
    154
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Q
      quant12345 last edited by quant12345

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

      picture1
      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()".

      self._chart.axisX(self._candlestick_serie).setVisible(False)
      self._line_serie.setVisible(False)
      

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

      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
         INDEX++;
         }
      

      English is not my native language, please be sympathetic)

      1 Reply Last reply Reply Quote 0
      • Q
        quant12345 last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post