Splunk Search

columnグラフにlineグラフをのせたときの単位の設定方法

appleman
Contributor

alt text以下の画像のように、棒グラフ上にライングラフを載せた場合、両サイドに棒グラフの単位とライングラフの単位が表示されると思いますが、この単位を両サイド同じ単位(間隔)に合わせる方法をご教示下さい。

Hello,
I created the following chart graph. What I'm trying to do here is matching the range in both sides. How can I change it? I found an answer said I need to add axis label maximum or minimum, but it didn't work well on mine. Is there any other way to set the range?

Thank you.

0 Karma
1 Solution

melonman
Motivator

以下のパラメータでy軸を無理やり合わせてみましたが、どうですかね?

<option name="charting.axisLabelsY.majorUnit">100</option>
<option name="charting.axisY.maximumNumber">1000</option>
<option name="charting.axisY.minimumNumber">0</option>

<option name="charting.axisLabelsY2.majorUnit">100</option>
<option name="charting.axisY2.maximumNumber">1000</option>
<option name="charting.axisY2.minimumNumber">0</option>

alt text

<dashboard>
  <label>今日のChart</label>
  <row>
    <chart>
      <searchString>
sourcetype=* | timechart span=1h count by host
| join _time [|search sourcetype=access_* host=apache1* | timechart span=1h count | streamstats window=5 sum(count) as cpu | eval cpu=abs(cpu-1800)/20 | fields - count | rename cpu as cpu_apache1 ]
| join _time [|search sourcetype=access_* host=apache2* | timechart span=1h count | streamstats window=5 sum(count) as cpu | eval cpu=abs(cpu-1800)/20 | fields - count | rename cpu as cpu_apache2 ]
| join _time [|search sourcetype=access_* host=apache3* | timechart span=1h count | streamstats window=5 sum(count) as cpu | eval cpu=abs(cpu-1800)/20 | fields - count | rename cpu as cpu_apache3 ]
| join _time [|search sourcetype=access_* host=* | timechart span=1h count | streamstats window=5 sum(count) as cpu | eval cpu=abs(cpu-1000)/20 | fields - count  | rename cpu as cpu_mysql ]
| table _time apache* mysql* cpu*
      </searchString>
      <title>こんなチャート</title>

      <option name="charting.transparentBrushPalette">solidFill</option>
      <option name="charting.transparentBrushPalette.colorPalette">@colorPalette</option>
      <option name="charting.transparentBrushPalette.alpha">0.7</option>

      <option name="charting.data1">view</option>
      <option name="charting.data1.table">@data</option>
      <option name="charting.data1.columns">[0,1,2,3,4]</option>
      <option name="charting.chart.data">@data1</option>

      <option name="charting.data2">view</option>
      <option name="charting.data2.table">@data</option>
      <option name="charting.data2.columns">[0,5,6,7,8]</option>
      <option name="charting.chart2.data">@data2</option>

      <option name="charting.axisY2">#axisY</option>                
      <option name="charting.axisLabelsY2">#axisLabelsY</option>
      <option name="charting.axisLabelsY2.axis">@axisY2</option>

      <option name="charting.chart">area</option>
      <option name="charting.chart.columnBrushPalette">@transparentBrushPalette</option>
      <option name="charting.chart.stackMode">stacked</option>
      <option name="charting.chart.useAbsoluteSpacing">True</option>
      <option name="charting.chart.columnSpacing">20</option>
      <option name="charting.chart.columnAlignment">.5</option>
      <option name="charting.axisTitleY.text">event count (件)</option>
      <option name="charting.axisLabelsY.placement">left</option>

      <option name="charting.axisLabelsY.majorUnit">100</option>
      <option name="charting.axisY.maximumNumber">1000</option>
      <option name="charting.axisY.minimumNumber">0</option>

      <option name="charting.chart2">line</option>
      <option name="charting.chart2.nullValueMode">zero</option>
      <option name="charting.chart2.axisY">@axisY2</option>
      <option name="charting.axisTitleY2">axisTitle</option>
      <option name="charting.axisTitleY2.text">cpu (%)</option>
      <option name="charting.axisLabelsY2.placement">right</option>

      <option name="charting.axisLabelsY2.majorUnit">100</option>
      <option name="charting.axisY2.maximumNumber">1000</option>
      <option name="charting.axisY2.minimumNumber">0</option>


      <option name="charting.layout.charts">[@chart,@chart2]</option>
      <option name="charting.layout.axisLabels">[@axisLabelsX,@axisLabelsY,@axisLabelsY2]</option>
      <option name="charting.layout.axisTitles">[@axisTitleX,@axisTitleY,@axisTitleY2]</option>
      <option name="charting.legend.placement">bottom</option>
    </chart>
  </row>
</dashboard>

View solution in original post

melonman
Motivator

以下のパラメータでy軸を無理やり合わせてみましたが、どうですかね?

<option name="charting.axisLabelsY.majorUnit">100</option>
<option name="charting.axisY.maximumNumber">1000</option>
<option name="charting.axisY.minimumNumber">0</option>

<option name="charting.axisLabelsY2.majorUnit">100</option>
<option name="charting.axisY2.maximumNumber">1000</option>
<option name="charting.axisY2.minimumNumber">0</option>

alt text

<dashboard>
  <label>今日のChart</label>
  <row>
    <chart>
      <searchString>
sourcetype=* | timechart span=1h count by host
| join _time [|search sourcetype=access_* host=apache1* | timechart span=1h count | streamstats window=5 sum(count) as cpu | eval cpu=abs(cpu-1800)/20 | fields - count | rename cpu as cpu_apache1 ]
| join _time [|search sourcetype=access_* host=apache2* | timechart span=1h count | streamstats window=5 sum(count) as cpu | eval cpu=abs(cpu-1800)/20 | fields - count | rename cpu as cpu_apache2 ]
| join _time [|search sourcetype=access_* host=apache3* | timechart span=1h count | streamstats window=5 sum(count) as cpu | eval cpu=abs(cpu-1800)/20 | fields - count | rename cpu as cpu_apache3 ]
| join _time [|search sourcetype=access_* host=* | timechart span=1h count | streamstats window=5 sum(count) as cpu | eval cpu=abs(cpu-1000)/20 | fields - count  | rename cpu as cpu_mysql ]
| table _time apache* mysql* cpu*
      </searchString>
      <title>こんなチャート</title>

      <option name="charting.transparentBrushPalette">solidFill</option>
      <option name="charting.transparentBrushPalette.colorPalette">@colorPalette</option>
      <option name="charting.transparentBrushPalette.alpha">0.7</option>

      <option name="charting.data1">view</option>
      <option name="charting.data1.table">@data</option>
      <option name="charting.data1.columns">[0,1,2,3,4]</option>
      <option name="charting.chart.data">@data1</option>

      <option name="charting.data2">view</option>
      <option name="charting.data2.table">@data</option>
      <option name="charting.data2.columns">[0,5,6,7,8]</option>
      <option name="charting.chart2.data">@data2</option>

      <option name="charting.axisY2">#axisY</option>                
      <option name="charting.axisLabelsY2">#axisLabelsY</option>
      <option name="charting.axisLabelsY2.axis">@axisY2</option>

      <option name="charting.chart">area</option>
      <option name="charting.chart.columnBrushPalette">@transparentBrushPalette</option>
      <option name="charting.chart.stackMode">stacked</option>
      <option name="charting.chart.useAbsoluteSpacing">True</option>
      <option name="charting.chart.columnSpacing">20</option>
      <option name="charting.chart.columnAlignment">.5</option>
      <option name="charting.axisTitleY.text">event count (件)</option>
      <option name="charting.axisLabelsY.placement">left</option>

      <option name="charting.axisLabelsY.majorUnit">100</option>
      <option name="charting.axisY.maximumNumber">1000</option>
      <option name="charting.axisY.minimumNumber">0</option>

      <option name="charting.chart2">line</option>
      <option name="charting.chart2.nullValueMode">zero</option>
      <option name="charting.chart2.axisY">@axisY2</option>
      <option name="charting.axisTitleY2">axisTitle</option>
      <option name="charting.axisTitleY2.text">cpu (%)</option>
      <option name="charting.axisLabelsY2.placement">right</option>

      <option name="charting.axisLabelsY2.majorUnit">100</option>
      <option name="charting.axisY2.maximumNumber">1000</option>
      <option name="charting.axisY2.minimumNumber">0</option>


      <option name="charting.layout.charts">[@chart,@chart2]</option>
      <option name="charting.layout.axisLabels">[@axisLabelsX,@axisLabelsY,@axisLabelsY2]</option>
      <option name="charting.layout.axisTitles">[@axisTitleX,@axisTitleY,@axisTitleY2]</option>
      <option name="charting.legend.placement">bottom</option>
    </chart>
  </row>
</dashboard>

appleman
Contributor

できました!ありがとうございました。

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...