Code Monkey home page Code Monkey logo

Comments (6)

JCQuintas avatar JCQuintas commented on July 23, 2024

Hi @MainaMwangiy we currently don't support that use-case. The closest you can get currently is a border around all of the "stacks" by reimplementing the Bar element.

export const Bar = styled(animated.rect, {
  name: 'MuiBarElement',
  slot: 'Root',
  overridesResolver: (_, styles) => styles.root,
})<{ ownerState: BarElementOwnerState }>(({ ownerState }) => ({
  fill: ownerState.isHighlighted
    ? d3Color(ownerState.color)!.brighter(0.5).formatHex()
    : ownerState.color,
  transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
  opacity: (ownerState.isFaded && 0.3) || 1,
  strokeWidth: 5,
  // This here, use your data instead of seriesA.data
  stroke: ownerState.dataIndex === seriesA.data.length - 1 ? 'black' : 'none',
}));

Screenshot 2024-07-03 at 14 42 24

You can find the code here: https://stackblitz.com/edit/react-6fcijw?file=Demo.tsx

from mui-x.

MainaMwangiy avatar MainaMwangiy commented on July 23, 2024

@JCQuintas Thanks for the prompt response. But I am facing a challenge using it with ResponsiveChartContainer. I want to have the black outline as you gave above based on a condition like if Average is present, then it should have a black outline. Please check the example and use case I am using. (https://stackblitz.com/edit/react-xh8m58?file=Demo.tsx)

from mui-x.

JCQuintas avatar JCQuintas commented on July 23, 2024

You could try to pass categories as ownerState through the slotProps as shown here: https://stackblitz.com/edit/react-xh8m58-yzhwyy?file=Demo.tsx

from mui-x.

MainaMwangiy avatar MainaMwangiy commented on July 23, 2024

@JCQuintas Again, Thanks for the swift response. The solution has now fully fixed my issue. Thank you.

from mui-x.

github-actions avatar github-actions commented on July 23, 2024

⚠️ This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@MainaMwangiy: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

from mui-x.

MainaMwangiy avatar MainaMwangiy commented on July 23, 2024

@JCQuintas I am facing one more issue on this. If I have a lot of options with 0,1,2 values, then the black outline color gets clamped together. And the UI looks bad. Check attached example. Is there a way to only show the outline on the outer stack borders? Without having the strike tough lines that are from left to right on the stacks.

What I am getting at the moment when I have may options.
image

What I want to achieve
image

Please let me know if there is a way and if we can reopen this until I get a full solution.

from mui-x.

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.