1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- # Copyright 2021-2025 Avaiga Private Limited
- #
- # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- # the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- # specific language governing permissions and limitations under the License.
- # -----------------------------------------------------------------------------------------
- # To execute this script, make sure that the taipy-gui package is installed in your
- # Python environment and run:
- # python <script>
- # -----------------------------------------------------------------------------------------
- import random
- from taipy.gui import Gui
- # Number of samples
- n_samples = 10
- # y values: [0..n_samples-1]
- y = range(0, n_samples)
- data = {
- # The x series is made of random numbers between 1 and 10
- "x": [random.uniform(1, 10) for _ in y],
- "y": y,
- }
- options = {
- "error_x": {
- "type": "data",
- # Allows for a 'plus' and a 'minus' error data
- "symmetric": False,
- # The 'plus' error data is a series of random numbers
- "array": [random.uniform(0, 5) for _ in y],
- # The 'minus' error data is a series of random numbers
- "arrayminus": [random.uniform(0, 2) for _ in y],
- # Color of the error bar
- "color": "red",
- }
- }
- page = """
- <|{data}|chart|type=bar|x=x|y=y|orientation=h|options={options}|>
- """
- if __name__ == "__main__":
- Gui(page).run(title="Chart - Error bars - Asymmetric")
|