{"record":{"id":"6efee2b1c87108ca","repo":"qax-os/excelize","slug":"chart-title-field-s-value-must-be-an-integer-from","errorCode":null,"errorMessage":"chart title field %s value must be an integer from 0 to 100","messagePattern":"chart title field (.+?) value must be an integer from 0 to 100","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":237,"sourceCode":"\treturn fmt.Sprintf(\"sheet %s does not exist\", err.SheetName)\n}\n\n// newAddCommentError defined the error message on the comment already exist in\n// the cell.\nfunc newAddCommentError(cell string) error {\n\treturn fmt.Errorf(\"comment already exist on cell %s\", cell)\n}\n\n// newCellNameToCoordinatesError defined the error message on converts\n// alphanumeric cell name to coordinates.\nfunc newCellNameToCoordinatesError(cell string, err error) error {\n\treturn fmt.Errorf(\"cannot convert cell %q to coordinates: %v\", cell, err)\n}\n\n// newChartTitleError defined the error message on receiving the invalid chart\n// title parameters.\nfunc newChartTitleError(name string) error {\n\treturn fmt.Errorf(\"chart title field %s value must be an integer from 0 to 100\", name)\n}\n\n// newCoordinatesToCellNameError defined the error message on converts [X, Y]\n// coordinates to alpha-numeric cell name.\nfunc newCoordinatesToCellNameError(col, row int) error {\n\treturn fmt.Errorf(\"invalid cell reference [%d, %d]\", col, row)\n}\n\n// newFieldLengthError defined the error message on receiving the field length\n// overflow.\nfunc newFieldLengthError(name string) error {\n\treturn fmt.Errorf(\"field %s must be less than or equal to 255 characters\", name)\n}\n\n// newInvalidAutoFilterColumnError defined the error message on receiving the\n// incorrect index of column.\nfunc newInvalidAutoFilterColumnError(col string) error {\n\treturn fmt.Errorf(\"incorrect index of column %q\", col)","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/qax-os/excelize/blob/f2483381fbfbe432a6baa98d48a1c277183f3285/errors.go#L219-L255","documentation":"newChartTitleError is returned when a chart title formatting field (such as rotation or size in ChartTitle/ChartAxis options) is outside the valid integer range 0-100. parseTitle validates these numeric fields while constructing the chart XML, since the OOXML spec restricts them to percentage-like values.","triggerScenarios":"f.AddChart with options where a title field (e.g. Title override or title format field set through parseTitle) is negative or greater than 100, or a non-integer out-of-range value.","commonSituations":"Passing degrees or pixel sizes into percentage-style fields; computing font size/rotation from user input without bounds checking; confusion between 0-100 percent and 0-360 degree units.","solutions":["Clamp the value into [0, 100] before building chart options","Convert units if you intended degrees (rotate = degrees, but validate 0-100 fields separately)","Add input validation in your UI/config layer so out-of-range values never reach AddChart"],"exampleFix":"// before\nopts.Rotation = rotationDegrees // e.g. 270\nf.AddChart(\"Sheet1\", \"A1\", opts)\n// after\nif opts.Rotation < 0 { opts.Rotation = 0 }\nif opts.Rotation > 100 { opts.Rotation = 100 }\nf.AddChart(\"Sheet1\", \"A1\", opts)","handlingStrategy":"validation","validationCode":"if v < 0 || v > 100 { return fmt.Errorf(\"title field must be 0-100\") }","typeGuard":"func in0100(v int) bool { return v >= 0 && v <= 100 }","tryCatchPattern":null,"preventionTips":["Clamp percentage-style title fields to [0,100] before AddChart","Don't mix degree units (0-360) with percent fields (0-100)","Validate chart options at the configuration/UI boundary"],"tags":["excelize","chart","range-validation","title"],"backgroundTag":"value-out-of-range","analyzedSha":"f2483381fbfbe432a6baa98d48a1c277183f3285","analyzedAt":"2026-09-02T01:26:19.299Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}