diff options
author | Huy Bui (Kevin) <2992996+huybuidev@users.noreply.github.com> | 2020-07-11 01:07:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-11 01:07:41 +0800 |
commit | 42b1c8148883844cf80b70a3096e6ee67be01f61 (patch) | |
tree | 81c4d51eac73eea324664b88120d1e634ffe3073 /drawing.go | |
parent | 49257c5918f3aa9f2730021a7e6a24b4835646fd (diff) |
Resolve #661 Add Logarithmic scale option support on Y axis (#662)
* Resolve #661 Add Logarithmic scale option support on Y axis
Example usage:
Add the following option into the format string when using AddChart:
"y_axis":{"scaling":{"logbase":"10"}}
* Change type of LogBase from attrValString to attrVarFloat
* Add test case for testing Logarithmic Option in Y axis of charts
* Move field `LogBase` in the format string up one level (remove `Scaling`) as suggested the owner
Test cases are updated accordingly.
Diffstat (limited to 'drawing.go')
-rw-r--r-- | drawing.go | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1000,10 +1000,17 @@ func (f *File) drawPlotAreaValAx(formatSet *formatChart) []*cAxs { if formatSet.YAxis.Maximum == 0 { max = nil } + var logBase *attrValFloat + // Follow OOXML requirements on + // [https://github.com/sc34wg4/OOXMLSchemas/blob/2b074ca2c5df38b18ac118646b329b508b5bdecc/Part1/OfficeOpenXML-XMLSchema-Strict/dml-chart.xsd#L1142-L1147] + if formatSet.YAxis.LogBase >= 2 && formatSet.YAxis.LogBase <= 1000 { + logBase = &attrValFloat{Val: float64Ptr(formatSet.YAxis.LogBase)} + } axs := []*cAxs{ { AxID: &attrValInt{Val: intPtr(753999904)}, Scaling: &cScaling{ + LogBase: logBase, Orientation: &attrValString{Val: stringPtr(orientation[formatSet.YAxis.ReverseOrder])}, Max: max, Min: min, |