summaryrefslogtreecommitdiff
path: root/chart.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2019-12-25 00:00:50 +0800
committerxuri <xuri.me@gmail.com>2019-12-25 00:00:50 +0800
commit5f3a4bc39f9cf2987104ffe57242a0526cdd9158 (patch)
tree057c9402385a9d1caa0feb18c9f5ac55447c2f8f /chart.go
parent1666d04559d9f5b579ab7c850ccc95863c31bd25 (diff)
Fix #538, added setting a major unit and tick label skip support for the chart
Diffstat (limited to 'chart.go')
-rw-r--r--chart.go26
1 files changed, 25 insertions, 1 deletions
diff --git a/chart.go b/chart.go
index 5a42c5b..b1446fb 100644
--- a/chart.go
+++ b/chart.go
@@ -653,10 +653,21 @@ func parseFormatChartSet(formatSet string) (*formatChart, error) {
//
// show_val: Specifies that the value shall be shown in a data label. The show_val property is optional. The default value is false.
//
-// Set the primary horizontal and vertical axis options by x_axis and y_axis. The properties that can be set are:
+// Set the primary horizontal and vertical axis options by x_axis and y_axis. The properties of x_axis that can be set are:
//
// major_grid_lines
// minor_grid_lines
+// major_unit
+// reverse_order
+// maximum
+// minimum
+//
+// The properties of y_axis that can be set are:
+//
+// major_grid_lines
+// minor_grid_lines
+// major_unit
+// tick_label_skip
// reverse_order
// maximum
// minimum
@@ -665,6 +676,10 @@ func parseFormatChartSet(formatSet string) (*formatChart, error) {
//
// minor_grid_lines: Specifies minor gridlines.
//
+// major_unit: Specifies the distance between major ticks. Shall contain a positive floating-point number. The major_unit property is optional. The default value is auto.
+//
+// tick_label_skip: Specifies how many tick labels to skip between label that is drawn. The tick_label_skip property is optional. The default value is auto.
+//
// reverse_order: Specifies that the categories or values on reverse order (orientation of the chart). The reverse_order property is optional. The default value is false.
//
// maximum: Specifies that the fixed maximum, 0 is auto. The maximum property is optional. The default value is auto.
@@ -1612,6 +1627,12 @@ func (f *File) drawPlotAreaCatAx(formatSet *formatChart) []*cAxs {
if formatSet.XAxis.MinorGridlines {
axs[0].MinorGridlines = &cChartLines{SpPr: f.drawPlotAreaSpPr()}
}
+ if formatSet.XAxis.MajorUnit != 0 {
+ axs[0].MajorUnit = &attrValFloat{Val: float64Ptr(formatSet.XAxis.MajorUnit)}
+ }
+ if formatSet.XAxis.TickLabelSkip != 0 {
+ axs[0].TickLblSkip = &attrValInt{Val: intPtr(formatSet.XAxis.TickLabelSkip)}
+ }
return axs
}
@@ -1658,6 +1679,9 @@ func (f *File) drawPlotAreaValAx(formatSet *formatChart) []*cAxs {
if pos, ok := valTickLblPos[formatSet.Type]; ok {
axs[0].TickLblPos.Val = stringPtr(pos)
}
+ if formatSet.YAxis.MajorUnit != 0 {
+ axs[0].MajorUnit = &attrValFloat{Val: float64Ptr(formatSet.YAxis.MajorUnit)}
+ }
return axs
}