Skip to content

Commit

Permalink
update relation
Browse files Browse the repository at this point in the history
  • Loading branch information
scott306lr committed Jan 13, 2023
1 parent 9e68501 commit 723f0c8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
Title,
Legend,
} from "chart.js";
import { getCountDict } from "../../utils/relationUtils";
import { iso_3166_1_2_digit_to_number_map } from "../../utils/isoMapping";
import { getCountDictV2 } from "../utils/relationUtils";
import { iso_3166_1_2_digit_to_number_map } from "../utils/isoMapping";

ChartJS.register(
Title,
Expand Down Expand Up @@ -37,7 +37,7 @@ export default function Map(data: any) {
});
}, []);

const movieCountryCount = getCountDict(
const { countDict: movieCountryCount } = getCountDictV2(
data["data"],
["countries"],
[],
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions movis/src/pages/overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { type NextPage } from "next";
import Head from "next/head";
import Navbar from "../../components/Navbar";
import { api } from "../../utils/api";
import Map from "./geo-map";
import Map from "../../components/geo-map";
import ZoomCard from "../../components/ZoomCard";
// import WordCloud from "./word-cloud";
import { getCountDict } from "../../utils/relationUtils";
import type { MovieData } from "../../utils/myClasses";
import WordCloudNew from "./word-cloud-better";
import WordCloudNew from "../../components/word-cloud-better";

// ChartJS stuff
import {
Expand Down
33 changes: 15 additions & 18 deletions movis/src/pages/relation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ const SelectionCard: React.FC<{
min="0"
step="1"
max={Math.min(props.max, 500).toString()}
defaultValue="0"
list="tickmarks"
value={props.value.toString()}
className="h-2 w-full bg-[#b75def]"
Expand All @@ -117,24 +116,23 @@ const MyMovieGraph: React.FC<{
data: MovieData[] | undefined;
}> = (props) => {
const [width, height] = useWindowSize();
const [vLang, setVLang] = useState<number>(5);
const [vWord, setVWord] = useState<number>(0);
const [vCrew, setVCrew] = useState<number>(30);
const [vGnre, setVGnre] = useState<number>(0);
const [vCtry, setVCtry] = useState<number>(0);
const [vComp, setVComp] = useState<number>(0);
const [vLang, setVLang] = useState<number>(10);
const [vWord, setVWord] = useState<number>(10);
const [vCrew, setVCrew] = useState<number>(10);
const [vGnre, setVGnre] = useState<number>(15);
const [vCtry, setVCtry] = useState<number>(10);
const [vComp, setVComp] = useState<number>(10);
const [toHide, setToHide] = useState<boolean[]>(Array(7).fill(false));
const [toDisable, setToDisable] = useState<boolean[]>(Array(7).fill(false));
const [toText, setToText] = useState<boolean[]>([
const [toDisable, setToDisable] = useState<boolean[]>([
false,
false,
true,
true,
false,
true,
true,
true,
true,
true,
false,
]);
const [toText, setToText] = useState<boolean[]>(Array(7).fill(false));

const { countDict: langDict, uniqueCount: langCnt } = useMemo(
() => getCountDictV2(props.data, ["spoken_languages"], [], "id", 0, vLang),
Expand Down Expand Up @@ -537,9 +535,9 @@ const Relation: NextPage = () => {
maxDate: appContext?.dateRange.endDate ?? new Date("2016-12-31"),
});

const [value, setValue] = useState(0);
const [value, setValue] = useState(50);
const subArray = useMemo(
() => getRandomSubarray(movies, value),
() => getRandomSubarray(movies, ((movies?.length ?? 0) * value) / 100),
[movies, value]
);

Expand Down Expand Up @@ -573,9 +571,8 @@ const Relation: NextPage = () => {
<input
type="range"
min="0"
step={Math.round(movies.length / 20).toString()}
max={movies.length.toString()}
defaultValue={movies.length.toString()}
step="5"
max="100"
list="tickmarks"
value={value.toString()}
className="h-2 w-full bg-[#b75def]"
Expand Down

0 comments on commit 723f0c8

Please sign in to comment.