Code Monkey home page Code Monkey logo

Comments (2)

gloriamannok avatar gloriamannok commented on September 22, 2024

Same here, any updates?

I'm trying to have bars for individual values (primary data) and a line for accumulative values (secondary data).
The line is not following secondary Y-axis scale :(

const data = [{value:200},{value:125},{value:175},{value:50}], 
  accData = [{value:200},{value:325},{value:500},{value:550}];

...

<BarChart
  frontColor={greenColor}
  data={data}
  maxValue={600}
  showLine
  lineConfig={{ /* for hiding the line for primary data */
      startIndex: 0,
      endIndex: 0,
      hideDataPoints: true,
      isSecondary: false
  }}
  lineConfig2={{
      color: blueColor,
      thickness: 3,
      hideDataPoints: true,
      isSecondary: true
  }}
  lineData2={accData}
  secondaryYAxis={{
      maxValue: accData[accData.length-1].value + 10
  }}
/>

IMG_5687

from react-native-gifted-charts.

Abhinandan-Kushwaha avatar Abhinandan-Kushwaha commented on September 22, 2024

Hi @ilyabreev 👋
Secondary Bars can now be achieved by setting isSecondary: true inside the data array objects. See #828

I have removed the secondaryData prop from Bar charts, as it was useless.

This is available from versions 1.4.35 onwards. Please use the latest version of the library.

@gloriamannok 👋
Can you try again in the latest version of the library? I have made fixes and refactors related to secondary data and the secondary Y-axis.
Also, you don't have to use the hack using 2 lines and 2 lineConfigs. Just have one lineConfig, and inside this set isSecondary: true. It will show the line from the lineData prop. If the lineData prop is not provided, then it renders the line from the data prop.

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.