Dashboards & Visualizations

May I center an x-axis label?

bwooden
Splunk Employee
Splunk Employee

Hello, I am trying to center a label on the x-axis, specifically for results that return only one column and have small label lengths. I have used some text and axis formatting options per The Docs in various attempts. Below is one such attempt that should be able to be copied and pasted into your favorite Splunk instance to play along at home.

Is there some technique I could use to center the label "a" relative to its column?

<?xml version='1.0' encoding='utf-8'?>
<dashboard>
  <label>deleteme - chart's "majorLabelAlignment" sandbox</label>
  <row>
    <chart>
      <searchString>| stats count | eval charted = "a,b,c,d,e,f,g,h" | makemv delim="," charted | mvexpand charted | stats count by charted</searchString>
      <title>beforeTick</title>
      <earliestTime></earliestTime>
      <latestTime></latestTime>
      <option name="charting.chart">column</option>
      <option name="charting.axisLabelsX.majorLabelAlignment">beforeTick</option>
    </chart>
    <chart>
      <searchString>| stats count | eval charted = "a,a,a,a,a,a,a,a" | makemv delim="," charted | mvexpand charted | stats count by charted</searchString>
      <title>beforeTick</title>
      <earliestTime></earliestTime>
      <latestTime></latestTime>
      <option name="charting.chart">column</option>
      <option name="charting.axisLabelsX.majorLabelAlignment">beforeTick</option>
    </chart>
  </row>
  <row>
    <chart>
      <searchString>| stats count | eval charted = "a,b,c,d,e,f,g,h" | makemv delim="," charted | mvexpand charted | stats count by charted</searchString>
      <title>atTick</title>
      <earliestTime></earliestTime>
      <latestTime></latestTime>
      <option name="charting.chart">column</option>
      <option name="charting.axisLabelsX.majorLabelAlignment">atTick</option>
    </chart>
    <chart>
      <searchString>| stats count | eval charted = "a,a,a,a,a,a,a,a" | makemv delim="," charted | mvexpand charted | stats count by charted</searchString>
      <title>atTick</title>
      <earliestTime></earliestTime>
      <latestTime></latestTime>
      <option name="charting.chart">column</option>
      <option name="charting.axisLabelsX.majorLabelAlignment">atTick</option>
    </chart>
  </row>
  <row>
    <chart>
      <searchString>| stats count | eval charted = "a,b,c,d,e,f,g,h" | makemv delim="," charted | mvexpand charted | stats count by charted</searchString>
      <title>afterTick</title>
      <earliestTime></earliestTime>
      <latestTime></latestTime>
      <option name="charting.chart">column</option>
      <option name="charting.axisLabelsX.majorLabelAlignment">afterTick</option>
    </chart>
    <chart>
      <searchString>| stats count | eval charted = "a,a,a,a,a,a,a,a" | makemv delim="," charted | mvexpand charted | stats count by charted</searchString>
      <title>afterTick</title>
      <earliestTime></earliestTime>
      <latestTime></latestTime>
      <option name="charting.chart">column</option>
      <option name="charting.axisLabelsX.majorLabelAlignment">afterTick</option>
    </chart>
  </row>
</dashboard>
1 Solution

sowings
Splunk Employee
Splunk Employee

Using the advanced charting doc, I found that this one worked, in combination with "afterTick":


<option name="charting.axisLabelsX.majorLabelStyle.alignmentX">0.5</option>

The range of that value is from 0 to 1 (left-aligned to right-aligned). Description of that particular parameter is here.

View solution in original post

bwooden
Splunk Employee
Splunk Employee

Per dialogue between answerer and asker outside of this page, the below solution works in flashchart but not presently jschart.

0 Karma

sowings
Splunk Employee
Splunk Employee

Using the advanced charting doc, I found that this one worked, in combination with "afterTick":


<option name="charting.axisLabelsX.majorLabelStyle.alignmentX">0.5</option>

The range of that value is from 0 to 1 (left-aligned to right-aligned). Description of that particular parameter is here.

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...