Code Monkey home page Code Monkey logo

Comments (8)

Abhinandan-Kushwaha avatar Abhinandan-Kushwaha commented on May 23, 2024

Hi @duc562000 πŸ‘‹

You can use the topLabelComponent property inside data objects.

Here's an example-

const data = [
    {value: 20},
    {value: 30},
    {value: 50, topLabelComponent: () => <Text style={{color:'red',fontSize:18,marginBottom:6}}>50</Text>},
    {value: 40},
    {value: 30},
  ];
  return (
    <View style={{flex:1,justifyContent:'center',alignItems:'center'}}>
      <BarChart width={300} data={data} />
    </View>
  );

Screenshot 2022-03-02 at 1 13 15 AM

Hope it helpsπŸ€—

from react-native-gifted-charts.

duc562000 avatar duc562000 commented on May 23, 2024

okey Thanks

from react-native-gifted-charts.

kholusoft avatar kholusoft commented on May 23, 2024

Any option to show value directly as topLabelComponent.

from react-native-gifted-charts.

Abhinandan-Kushwaha avatar Abhinandan-Kushwaha commented on May 23, 2024

Hi @kholusoft πŸ‘‹
From version 1.3.23 onwards we can show values directly as topLabelComponent, using the showValuesAsTopLabel prop.

I have added the props- showValuesAsTopLabel, topLabelContainerStyle and topLabelTextStyle to Bar charts.

Here's an example-

topLabel

The code for the above chart is-

const data = [{value: 6}, {value: 8}, {value: 5}, {value: 5}, {value: 8}]

return <BarChart
  data={data}
  showValuesAsTopLabel
  topLabelTextStyle={{color:'brown', fontWeight:'bold'}}
/>

from react-native-gifted-charts.

kholusoft avatar kholusoft commented on May 23, 2024

from react-native-gifted-charts.

kholusoft avatar kholusoft commented on May 23, 2024

from react-native-gifted-charts.

kholusoft avatar kholusoft commented on May 23, 2024

from react-native-gifted-charts.

Abhinandan-Kushwaha avatar Abhinandan-Kushwaha commented on May 23, 2024

Thanks a lot. Is there any way to reduce bottom margin below bar chart. I find high margin below charts
…
On Sat, Nov 25, 2023 at 4:44β€―AM Abhinandan Kushwaha < @.***> wrote: Hi @kholusoft https://github.com/kholusoft πŸ‘‹ From version 1.3.23 onwards we can show values directly as topLabelComponent, using the showValuesAsTopLabel prop. I have added the props- showValuesAsTopLabel, topLabelContainerStyle and topLabelTextStyle to Bar charts. Here's an example- topLabel.png (view on web) https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/assets/20596944/1de7294a-31e7-46ff-996a-cadb17bee4e9 The code for the above chart is- const data = [{value: 6}, {value: 8}, {value: 5}, {value: 5}, {value: 8}] return <BarChart data={data} showValuesAsTopLabel topLabelTextStyle={{color:'brown', fontWeight:'bold'}}/> β€” Reply to this email directly, view it on GitHub <#99 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIBDHHSJK3P4REIORYNCIDYGES6VAVCNFSM5PUS62LKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBSGYYTGMRVG44A . You are receiving this because you were mentioned.Message ID: </issues/99/1826132578@ github.com>

@kholusoft Are you still facing this issue (margin bottom below the bar) in the latest version 1.3.24 ?

from react-native-gifted-charts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.