Changing axis label color in LightningChart JS - charts

The chart appears with dark background, axis numeric labels in grid positions are yellow.
How do I change axis label colors to white?
E.g. in this example https://www.arction.com/lightningchart-js-interactive-examples/#edit/lcjs_example_0001_simpleScatter
I'm trying
chart.getDefaultAxisX()
.setInterval(0, 92 * dataFrequency)
.setTickStyle((visibleTicks) => visibleTicks
.setLabelFillStyle( color: ColorRGBA(255, 255, 255) })
)
But it's giving SyntaxError: Unexpected token, expected ","

According to the documentation it expects you to pass FillStyle, not just color. The solution for your case is as follows:
chart.getDefaultAxisX()
.setInterval(0, 92 * dataFrequency)
.setTickStyle( (visibleTicks) => visibleTicks
.setLabelFillStyle(
new SolidFill( { color: ColorRGBA(255, 255, 255) } )
)
)

Related

plotly r sankey add_trace

i am reading the document https://plotly.com/r/reference/sankey/, and want to change the links color for a sankey chart. But i can't quite understand the parameters in add_trace() function
where should i specify the color value?
add_trace(p,type='sankey', color=????)
You haven't provided a minimal reproducible example, so I can't jump right into your code. But I think I can point you in the right direction.
In the documentation you screenshotted, it's saying that the color argument is one key of the list link that defines links in the plot. Using this example from the R plotly documentation for adding links, let's take a look at where that goes:
library(plotly)
library(rjson)
json_file <- "https://raw.githubusercontent.com/plotly/plotly.js/master/test/image/mocks/sankey_energy.json"
json_data <- fromJSON(paste(readLines(json_file), collapse=""))
fig <- plot_ly(
type = "sankey",
domain = list(
x = c(0,1),
y = c(0,1)
),
orientation = "h",
valueformat = ".0f",
valuesuffix = "TWh",
node = list(
label = json_data$data[[1]]$node$label,
color = json_data$data[[1]]$node$color,
pad = 15,
thickness = 15,
line = list(
color = "black",
width = 0.5
)
),
link = list(
source = json_data$data[[1]]$link$source,
target = json_data$data[[1]]$link$target,
value = json_data$data[[1]]$link$value,
label = json_data$data[[1]]$link$label,
#### Color goes here! ####
color = "yellow"
)
)
fig <- fig %>% layout(
title = "Energy forecast for 2050<br>Source: Department of Energy & Climate Change, Tom Counsell via <a href='https://bost.ocks.org/mike/sankey/'>Mike Bostock</a>",
font = list(
size = 10
),
xaxis = list(showgrid = F, zeroline = F),
yaxis = list(showgrid = F, zeroline = F)
)
fig
The plotly documentation can be a bit opaque at times. I have found it helpful to sometimes review the documentation for python. For example, this part of the python documentation does give some more guidance about changing link colors.

How to get string value centered above bars in bar chart

I am having trouble aligning the text above the correct bars in the following bar graph, I can't figure out where it's going wrong?
CODE:
bar(two_weeks,zAxis);
text(1:length(two_weeks),zAxis,num2str(zAxis),'vert','bottom','horiz','center');
box off
ylabel('Z Axis')
BAR CHART:
The arrows were added post production and are showing where they should be aligned to. Also note that I was too lazy to draw all of the arrows.
DATA:
two_weeks =
1×14 datetime array
[ 21-Nov-2018, 22-Nov-2018, 23-Nov-2018, 24-Nov-2018, 25-Nov-2018, 26-Nov-2018, 27-Nov-2018, ...
28-Nov-2018, 29-Nov-2018, 30-Nov-2018, 01-Dec-2018, 02-Dec-2018, 03-Dec-2018, 04-Dec-2018 ]
zAxis =
[ 5, 12, 1, 7, 13, 24, 2, 27, 62, 0, 3, 17, 74, 4 ].'
Your x axis is specified using a datetime array. What you're then using is guesswork to align indices (1:length(two_weeks)) for the x coordinates of your text items.
Instead, simply use the same datetime array for the position of the text!
bar( two_weeks, zAxis );
text( two_weeks, zAxis, arrayfun(#num2str,zAxis,'uni',0) );
As you did in the question, we want to set 'VerticalAlignment' to 'bottom' and 'HorizontalAlignment' to 'center' to neaten things up above the bars:
bar( two_weeks, zAxis );
text( two_weeks, zAxis, arrayfun(#num2str,zAxis,'uni',0), ...
'VerticalAlignment', 'bottom', 'HorizontalAlignment', 'center' );
Output:

SSRS - Conditional formatting not getting applied?

I have the following expression to apply background colour to a text box but only the red colour is getting applied when that condition is true. All the other conditions are showing up as white? For example when the first condition is true when the report renders, the background colour is white instead of green?
=IIF(Round(SUM(CInt(Fields!TotalAchieved.Value) * 7.14)) >= 86, "Green",
IIF(Round(SUM(CInt(Fields!TotalAchieved.Value) * 7.14)) >= 79 AND
Round(SUM(CInt(Fields!TotalAchieved.Value) * 7.14)) <= 85, "Light Green",
IIF(Round(SUM(CInt(Fields!TotalAchieved.Value) * 7.14)) >= 64 AND
Round(SUM(CInt(Fields!TotalAchieved.Value) * 7.14)) <= 78, "Yellow", "Red" )))
It would seem that your SUM(CINT(Fields!TotalAchieved.Value) * 7.14) calculation is not giving you the results you expect . The first thing I would do is add a column that shows this value to make sure that it's gives you what you expect.
Once you have that correct then I would also suggest that you use a SWITCH statement rather than nested IIFs, they are much easier to read/debug.
You expression would be
=SWITCH(
Round(SUM(CInt(Fields!TotalAchieved.Value) * 7.14)) >= 86, "Green",
Round(SUM(CInt(Fields!TotalAchieved.Value) * 7.14)) >= 79, "LightGreen",
Round(SUM(CInt(Fields!TotalAchieved.Value) * 7.14)) >= 64, "Yellow",
TRUE, "Red"
)
This way you don't need to check for ranges as, for example, if the value was 75, the 1st expression fails but the second one is true so SWITCH will stop at that point and not evaluate the rest, if all fail then the final TRUE will act like an else.

gnuplot histogram with Perl: How to put values on top of bars

How can the following gnuplot plot can be generate using Perl ?
(I need a histogram where under each bar I will write the difference between that column and the column on its right side, with the same data)
The problem is that I didn't figure out how to put numbers under the bars, using Perl.
This is the code of gnuplot:
reset
set terminal png
set output 'StackOverflow.png'
set style fill solid 1.00
set style histogram clustered gap 1
set style data histograms
set yrange [0:120]
set xtics norangelimit font ",8"
set ytics norangelimit font ",8"
set key font ",8"
set key width -8
xoffset=0.17
yoffset=0.03
plot 'data.dat' using 2:xtic(1) with histogram title "Parameter 1", \
'' u 3 with histogram title "Parameter 2", \
'' u 0:2:4 with labels offset -0.9,0.5 title "", \
'' u 0:3:5 with labels offset 2.0,0.5 title ""
Currently I have generated the following using Perl:
And this is the Perl code:
#!/usr/bin/perl -w
use strict;
use Chart::Gnuplot;
my $chart = Chart::Gnuplot->new(
output => 'plotStyle_19.png',
yrange => [0, 120],
bg => {
color => "#c9c9ff",
density => 0.2,
},
);
my #x = qw( A B C D );
my $h1 = Chart::Gnuplot::DataSet->new(
xdata => \#x,
ydata => [99, 97, 97, 95],
title => "1st data set",
color => "purple",
fill => {density => 0.2},
style => "histograms",
);
my $h2 = Chart::Gnuplot::DataSet->new(
xdata => \#x,
ydata => [9, 10, 13, 15],
title => "2nd data set",
color => "dark-green",
fill => {density => 0.2},
style => "histograms",
);
$chart->plot2d($h1, $h2);

Three20 TTStyle Drop-shadow

I'm trying to create a fancy-looking header to a view. I'm using a TTView with styling applied, but my problem is I want the drop shadow to just drop below the image, and not to the sides. I want the sides hard up against the screen edges.
Here is what it looks like at the moment:
How can I make it so the sides are hard up against the edge of the screen?
Here is my code for the styling:
UIColor* black = RGBCOLOR(158, 163, 172);
UIColor* blue = RGBCOLOR(191, 197, 208);
TTStyle *style =
[TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.5) blur:5 offset:CGSizeMake(0, 2) next:
[TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(255, 255, 255)
color2:RGBCOLOR(216, 221, 231) next:
[TTFourBorderStyle styleWithTop:blue right:black bottom:black left:blue width:1 next:nil]]];
headerView.style = style;
I would appreciate any help with this issue as I've never used three20 before now.
I figured it out by experimentation in the end - if you use a negative UIEdgeMask on the sides before the drop-shadow in the style chain, it pushes the main view out to the edges.
TTStyle *style =
[TTInsetStyle styleWithInset:UIEdgeInsetsMake(0, -5, 0, -5) next:
[TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.5) blur:5 offset:CGSizeMake(0, 2) next:
[TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(255, 255, 255)
color2:RGBCOLOR(216, 221, 231) next:
[TTFourBorderStyle styleWithBottom:black width:1 next:nil]]]];
self.btn1.layer.shadowOffset = CGSizeMake(10, 10); //set the the value for the shade size when the negative that goes to oposite side of current.
self.btn1.layer.shadowOpacity = 0.9;
self.btn1.layer.shouldRasterize = YES;
self.btn1.layer.shadowColor=[[UIColor grayColor]CGColor];
May this code is helping to you