Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Is it possible to highlight an X-axis label in a FacetChart?

    Hi there,

    Using SmartClient 11.1 Pro, I want to know whether it's possible to highlight one of the X-axis labels? The use case that I have is that one of the values in the chart should somehow be highlighted, either with different styling of the X-axis label or using a vertical line in the chart itself. I have a chart for stock levels in a warehouse and on the X-axis I present week numbers. One of those weeks is special and I want to highlight it. In my data, there's an attribute indicating this special week.

    I've attached a example that hopefully demonstrates my wish.
    Attached Files

    #2
    Hi wallytax,

    not sure it works declaratively (set a property to match your data field), but it will surly work programmatically, see here.

    Best regards
    Blama

    Comment


      #3
      Thanks Blama for pointing me to that example. With it, I managed to create something.

      I was wondering if there's a way to get to the X-position of a certain data point? I'm now dividing the chart's width by the number of items (52) and multiplying it with the index of the record that I'm searching for in the data. This is the code I have now, but I think there's a better way to get to that X-position.

      Code:
        chartBackgroundDrawn: function() {
          var index, x;
      
          index = this.getFacetData().findIndex('special_item', true);
          x = this.getChartLeft() + this.getChartWidth() * (index + 0.5) / 52;
      
          return isc.DrawLine.create({
            autoDraw: true,
            drawPane: this,
            endPoint: [x, this.getChartTop() + this.getChartHeight()],
            startPoint: [x, this.getChartTop()]
          }, { ... (line properties) });
      Last edited by wallytax; 24 Nov 2020, 03:31.

      Comment

      Working...
      X