Cannot set nivo pie chart color scheme - reactjs

I integrated the nivo library. I managed to get this pie chart to work:
For this, I used this slightly modified code from the example:
<ResponsivePie
data={data}
margin={config.margins}
padding={0.3}
colors="nivo"
borderColor="inherit:darker(1.6)"
animate
motionStiffness={90}
motionDamping={15}
legends={config.legends}
sortByValue
innerRadius={0}
padAngle={0}
cornerRadius={0}
borderWidth={0}
radialLabelsSkipAngle={10}
radialLabelsTextXOffset={6}
radialLabelsTextColor="#333333"
radialLabelsLinkOffset={0}
radialLabelsLinkDiagonalLength={16}
radialLabelsLinkHorizontalLength={24}
radialLabelsLinkStrokeWidth={1}
radialLabelsLinkColor="#CCCCCC"
slicesLabelsSkipAngle={10}
slicesLabelsTextColor="#333333"
/>
Now, I wanted the colors to be a grayscale, so I changed the colors prop to "greys", as shown in their docs:
colors={{ scheme: 'greys' }}
This results in:
I also tried:
colors="greys"
Using "greens" also results in the same.
If you want to try it out:
What do I need to do?

I see that this is an old question, but I recently encountered the same issue when integrating with nivo. However I did find a solution so I decided to share it anyway.
After playing around with it I found that the code provided in the interactive view is not valid in React, if you would like to use a theme you should use the following syntax:
colors={"nivo"} // or the name of the theme you picked
instead of:
colors={{ scheme: 'nivo' }}
PS: If you want to use some of the other themes you might need to supply them additionally since just a couple of them come with nivo by default.

Related

Tailwindcss v2 not applying the correct style to element (mt-5 styles with 3rem instead of 1.25rem)

Certain styles in my project are not applying correctly. The easiest example to illustrate is mt-5 which according to the docs should be 1.25rem, but instead, my project shows as 3rem.
I've tried going to my tailwind.config.js and adding important: true to it and it does work! But I'm wondering if there's another way to fix this.

React-fiber (drei) ScrollControls prevent<Html> from scrolling

I've noticed in V9 of drei there is a bug when combing the <Html> elment with <ScrollControls>.
I just want bind text to a 3D element but the ScrollControll makes the text scroll out of the view: CodeSandBox Example
It works fine in v8: CodeSandBox Example
I fixed this in this PR https://github.com/pmndrs/drei/pull/1126 we just have to wait until they approve it. But you can just patch the library yourself using https://www.npmjs.com/package/patch-package, it should be easy as it is just one line change.
Edit: Now that I think about it, you could probably fix it also by sending gl.domElement.parentNode as the portal prop.

React with tinyMCE - how to output HTML without seeing balises in front-end?

I'm a new user of TinyMCE, and i'm trying to incorporate it in my React App. But i'ma actually getting an output problem. When try "format:text" in the tiny component, and try to create a post in my blog using bold and italic options, when the post is posted, the displayed text is just normal, without bold or italic properties. So, I've tried the "format:html" but in this case, I get my text without any styles at all, AND we see the <p> balises.
So, it can looks like a stupid question but, how do we output the posted text correctly ?
As always, thx in advance !
This happened to me as well. If you do not want to see the attributes on your output then go to the React Component which is responsible for output and in your React component when you use the return() keyword you should create a div use the
dangerouslySetInnerHTML attribute inside.
Example:
Here's [a link] (https://blog.logrocket.com/using-dangerouslysetinnerhtml-in-a-react-application/)

Balise <sup> is displaying like <sub> in react-native-render-html custom renderer

I'm using react-native-render-html to render html and the HTML Tag is like a defines subscript text.
Au IV<sup>e</sup>
In my app :
I'm trying to have style to avoid that but I think there is better way to solve the issue.
What to you thing
The default style for <sup> element looks like this:
{
textAlignVertical: 'top',
fontSize: 'smaller'
}
Unfortunately, there is a bug on React Native whereby textAlignVertical: 'top' doesn't work for nested Text elements on Android.
I've also submitted a feature request for 'sub' and 'sup' support in their Canny.
I suggest you:
Upvote the Canny feature request;
Upvote the bug report;
That would help giving more visibility to those issues. And if you or your team has any Android SDK experience, you could also submit a fix upstream. Check the bug report thread as a contributor seems engaged in resolving the issue.

ShieldUI Chart Y Axis styling not working properly

I'm evaluating ShieldUI for a client's application and I've run into an issue with setting styles on the Y axis header. Below is the code from the view:
#(Html.ShieldChart(Model)
.Name("chart")
.PrimaryHeader(header => header.Text("")) //no header needed
.Export(true) //turn on export
.ChartLegend(legend => legend.Enabled(false)) //turn off legend since there's only 1 series
.Tooltip(tooltip =>
tooltip.ChartBound(true)
//turn on the axis marker tooltip thingy
.AxisMarkers(axisMarkers =>
axisMarkers.Enabled(true).Mode(TooltipAxisMarkerMode.XY)
.Width(1).ZIndex(3)
)
.CustomHeaderText("{point.pointName:MM-yyyy}")
.CustomPointText("{point.y:c}")
)
.AxisX(axisX => axisX
.CategoricalValues(model => model.Date)
.Title(title => title.Text("Month").Style(style => style.FontWeight(FontWeight.Bold)))
.AxisTickText(axisTickText => axisTickText.Format("{text:MM-yyyy}")))
.AxisY(axisY => axisY
.Title(title => title.Text("Price").Style(style => style.FontWeight(FontWeight.Bold)))
.AxisTickText(axisTickText => axisTickText.Format("{text:c}")))
.DataSeries(dataSeries => dataSeries.Line()
.Data(model => model.Price)))
The bold setting on the x axis works fine, but I can't get bold or size to work on the Y axis. It looks like there may be something wrong with the markup that gets generated. Below are the two text elements from the markup:
<text x="432" y="375" style="font-family:Segoe UI, Tahoma, Verdana, sans-serif;font-size:12px;color:#404040;font-weight:bold;fill:#404040;" zIndex="7" text-anchor="middle" visibility="visible"><tspan x="432">Month</tspan></text>
<text x="25" y="181" style="font-family:Segoe UI, Tahoma, Verdana, sans-serif;font-size:12px;color:#636363;font-weight:bold;font:11px Segoe UI, Tahoma, Verdana, sans-serif;fill:#636363;" zIndex="7" transform="rotate(270 25 181)" text-anchor="middle" visibility="visible"><tspan x="25">Price</tspan></text>
The first one works fine, the second one doesn't, and I notice that the way they define their font information is different (the first using font-family and font-size, the second using a single font setting. If I copy (via firebug) the style definition from the x to the y, the y axis becomes properly bolded.
Is there something I'm doing wrong, or is this a bug with the way ShieldUI generates the SVG? If it is a bug, any chance of it being fixed any time soon? I can think of several ways to work around the problem, but I'd rather leave hacks out if possible and just wait for a fix if one would be on the horizon.
Edit: I realized that I'd copied markup for the Y axis that didn't match the view code I'd included here, so I updated that. After doing so, I realized that the tag is getting a "font:" style added at the end after it has already defined the family, size, etc. That makes me think even more so that this is a bug with ShieldUI in how it generates that markup.
We've identified a bug in the Shield UI JavaScript Chart component that also affected the ASP.NET and MVC wrappers. The behavior you're describing was due to an issue in the way font settings were applied to chart axis titles. In some situations, the Shield UI Chart applied a default font style that prevented settings like fontSize and fontWeight from getting applied.
The issue was fixed shortly after discovery and will be available in the upcoming 1.6.4 version of the Shield UI JavaScript suite expected in the coming week. The fix is compatible with all server-side wrappers, including ASP.NET MVC.

Resources